Total Complexity | 7 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 88.24% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class Jsonapi implements \JsonSerializable, Arrayable, Jsonable |
||
12 | { |
||
13 | use HasMeta; |
||
14 | |||
15 | /** |
||
16 | * @var string|null |
||
17 | */ |
||
18 | protected $version; |
||
19 | |||
20 | 20 | public function __construct(?string $version = null, ?Meta $meta = null) |
|
24 | 10 | } |
|
25 | |||
26 | /** |
||
27 | * @return string|null |
||
28 | */ |
||
29 | 12 | public function getVersion() |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | 8 | public function toArray(): array |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * |
||
55 | * @param int $options |
||
56 | * @return false|string |
||
57 | */ |
||
58 | public function toJson($options = 0) |
||
59 | { |
||
60 | return json_encode($this->jsonSerialize(), JSON_THROW_ON_ERROR | $options); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | * |
||
66 | * @return object |
||
67 | */ |
||
68 | 4 | #[\ReturnTypeWillChange] |
|
72 | } |
||
73 | } |
||
74 |