Total Complexity | 9 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class UserPicture implements Hydratable |
||
9 | { |
||
10 | |||
11 | private string $path; |
||
12 | private int $width; |
||
13 | private int $height; |
||
14 | private bool $isDefault; |
||
15 | |||
16 | public static function load(array $data): Hydratable |
||
17 | { |
||
18 | $userPicture = new self; |
||
19 | Assert::string($data['path']); |
||
20 | Assert::numeric($data['width']); |
||
21 | Assert::numeric($data['height']); |
||
22 | Assert::boolean($data['isDefault']); |
||
23 | |||
24 | $userPicture->setPath($data['path']); |
||
25 | $userPicture->setWidth($data['width']); |
||
26 | $userPicture->setHeight($data['height']); |
||
27 | $userPicture->setIsDefault($data['isDefault']); |
||
28 | |||
29 | |||
30 | return $userPicture; |
||
31 | } |
||
32 | |||
33 | private function setPath(string $path) |
||
34 | { |
||
35 | $this->path = $path; |
||
36 | } |
||
37 | |||
38 | private function setWidth(int $width) |
||
39 | { |
||
40 | $this->width = $width; |
||
41 | } |
||
42 | |||
43 | private function setHeight(int $height) |
||
44 | { |
||
45 | $this->height = $height; |
||
46 | } |
||
47 | |||
48 | private function setIsDefault(bool $isDefault) |
||
51 | } |
||
52 | |||
53 | public function getPath(): string |
||
54 | { |
||
55 | return $this->path; |
||
56 | } |
||
57 | |||
58 | public function getWidth(): int |
||
61 | } |
||
62 | |||
63 | public function getHeight(): int |
||
64 | { |
||
65 | return $this->height; |
||
66 | } |
||
67 | |||
68 | public function isDefault(): bool |
||
71 | } |
||
72 | |||
73 | |||
74 | } |
||
75 |