| Total Complexity | 9 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | 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): UserPicture |
||
| 17 | { |
||
| 18 | $userPicture = new self; |
||
| 19 | Assert::string($data['path']); |
||
| 20 | Assert::integer($data['width']); |
||
| 21 | Assert::integer($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): UserPicture |
||
| 34 | { |
||
| 35 | $this->path = $path; |
||
| 36 | return $this; |
||
| 37 | } |
||
| 38 | |||
| 39 | private function setWidth(int $width): UserPicture |
||
| 40 | { |
||
| 41 | $this->width = $width; |
||
| 42 | return $this; |
||
| 43 | } |
||
| 44 | |||
| 45 | private function setHeight(int $height): UserPicture |
||
| 46 | { |
||
| 47 | $this->height = $height; |
||
| 48 | return $this; |
||
| 49 | } |
||
| 50 | |||
| 51 | private function setIsDefault(bool $isDefault): UserPicture |
||
| 55 | } |
||
| 56 | |||
| 57 | public function getPath(): string |
||
| 58 | { |
||
| 59 | return $this->path; |
||
| 60 | } |
||
| 61 | |||
| 62 | public function getWidth(): int |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getHeight(): int |
||
| 68 | { |
||
| 69 | return $this->height; |
||
| 70 | } |
||
| 71 | |||
| 72 | public function isDefault(): bool |
||
| 75 | } |
||
| 76 | |||
| 77 | |||
| 78 | } |
||
| 79 |