| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class Side |
||
| 10 | { |
||
| 11 | public const TOP = 'TOP'; |
||
| 12 | public const BOTTOM = 'BOTTOM'; |
||
| 13 | public const FRONT = 'FRONT'; |
||
| 14 | public const BACK = 'BACK'; |
||
| 15 | public const RIGHT = 'RIGHT'; |
||
| 16 | public const LEFT = 'LEFT'; |
||
| 17 | |||
| 18 | public function __construct(protected Point $topLeft, protected Point $bottomRight) |
||
| 19 | { |
||
| 20 | } |
||
| 21 | |||
| 22 | public function getTopLeft(): Point |
||
| 23 | { |
||
| 24 | return $this->topLeft; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function getBottomRight(): Point |
||
| 28 | { |
||
| 29 | return $this->bottomRight; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function getWidth(): int |
||
| 33 | { |
||
| 34 | return $this->bottomRight->getX() - $this->topLeft->getX(); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getHeight(): int |
||
| 38 | { |
||
| 39 | return $this->bottomRight->getY() - $this->topLeft->getY(); |
||
| 40 | } |
||
| 41 | |||
| 42 | public static function fromRawPoints(array $rawPoints): self |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |