Browse Source

Added JsonSer. to Symbol

Joachim M. Giæver 4 years ago
parent
commit
cb9453c0d4
1 changed files with 5 additions and 1 deletions
  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)",