| Total Complexity | 2 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class TypeValue implements \JsonSerializable |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var string |
||
| 9 | */ |
||
| 10 | public $id; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | public $value; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | public $synonyms; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string $id |
||
| 24 | * @param string $value |
||
| 25 | * @param array $synonyms |
||
| 26 | * |
||
| 27 | * @return TypeValue |
||
| 28 | */ |
||
| 29 | public static function create(string $id, string $value, array $synonyms = []): self |
||
| 30 | { |
||
| 31 | $typeValue = new self(); |
||
| 32 | |||
| 33 | $typeValue->id = $id; |
||
| 34 | $typeValue->value = $value; |
||
| 35 | $typeValue->synonyms = $synonyms; |
||
| 36 | |||
| 37 | return $typeValue; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Specify data which should be serialized to JSON. |
||
| 42 | * |
||
| 43 | * @link https://php.net/manual/en/jsonserializable.jsonserialize.php |
||
| 44 | * |
||
| 45 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
| 46 | * which is a value of any type other than a resource |
||
| 47 | * |
||
| 48 | * @since 5.4.0 |
||
| 49 | */ |
||
| 50 | public function jsonSerialize() |
||
| 57 | ], |
||
| 58 | ]; |
||
| 61 |