| Total Complexity | 6 |
| Total Lines | 67 |
| 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 | /** @var Point */ |
||
| 19 | protected Point $topLeft; |
||
| 20 | |||
| 21 | /** @var Point */ |
||
| 22 | protected Point $bottomRight; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param Point $topLeft |
||
| 26 | * @param Point $bottomRight |
||
| 27 | */ |
||
| 28 | public function __construct(Point $topLeft, Point $bottomRight) |
||
| 29 | { |
||
| 30 | $this->topLeft = $topLeft; |
||
| 31 | $this->bottomRight = $bottomRight; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return Point |
||
| 36 | */ |
||
| 37 | public function getTopLeft(): Point |
||
| 38 | { |
||
| 39 | return $this->topLeft; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return Point |
||
| 44 | */ |
||
| 45 | public function getBottomRight(): Point |
||
| 46 | { |
||
| 47 | return $this->bottomRight; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return int |
||
| 52 | */ |
||
| 53 | public function getWidth(): int |
||
| 54 | { |
||
| 55 | return $this->bottomRight->getX() - $this->topLeft->getX(); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return int |
||
| 60 | */ |
||
| 61 | public function getHeight(): int |
||
| 62 | { |
||
| 63 | return $this->bottomRight->getY() - $this->topLeft->getY(); |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param array $rawPoints |
||
| 68 | * |
||
| 69 | * @return Side |
||
| 70 | */ |
||
| 71 | public static function fromRawPoints(array $rawPoints): self |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | } |
||
| 79 |