Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
5 | class AttributeModel implements \JsonSerializable |
||
6 | { |
||
7 | protected ?string $thumbnail = null; |
||
8 | |||
9 | public function __construct(public int $id, public string $name, public string $value, array $thumbnail = []) |
||
10 | { |
||
11 | if (!empty($thumbnail)) { |
||
12 | $this->thumbnail = $thumbnail['url']; |
||
13 | } |
||
14 | } |
||
15 | |||
16 | |||
17 | /** |
||
18 | * toArray |
||
19 | * @return array<string,null|string>> |
||
20 | */ |
||
21 | public function toArray(): array |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * jsonSerialize |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function jsonSerialize() |
||
38 | { |
||
39 | return $this->toArray(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * __toString |
||
44 | * @return string |
||
45 | */ |
||
46 | public function __toString(): string |
||
49 | } |
||
50 | |||
51 | } |