Explorar el Código

Added JsonSer. to Symbol

Joachim M. Giæver hace 4 años
padre
commit
cb9453c0d4
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      src/Yr/Forecast/Tabular/Time/Symbol.php

+ 5 - 1
src/Yr/Forecast/Tabular/Time/Symbol.php

@@ -7,7 +7,7 @@ namespace App\Yr\Forecast\Tabular\Time;
  *
  * @author Joachim M. Giæver (joachim[]giaever.org)
  */
-class Symbol implements DiffInterface {
+class Symbol implements DiffInterface, \JsonSerializable {
 
     private $number;
     private $numberEx;
@@ -65,6 +65,10 @@ class Symbol implements DiffInterface {
         return $this->diff($e) != 0;
     }
 
+    public function jsonSerialize(): string {
+        return $this->__toString();
+    }
+
     public function __toString(): string {
         return sprintf(
             "%s: %s (%d)",