| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class VerticalPoint extends Point |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * Height. |
||
| 25 | * @var Length |
||
| 26 | */ |
||
| 27 | protected $height; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Coordinate reference system. |
||
| 31 | * @var CoordinateReferenceSystem |
||
| 32 | */ |
||
| 33 | protected $crs; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Constructor. |
||
| 37 | * @param Length $height refer to CRS for preferred unit of measure, but any length unit accepted |
||
| 38 | */ |
||
| 39 | 3 | public function __construct(Length $height, Vertical $crs) |
|
| 40 | { |
||
| 41 | 3 | $this->height = UnitOfMeasureFactory::convertLength($height, $crs->getCoordinateSystem()->getAxes()[1]->getUnitOfMeasureId()); |
|
| 42 | 3 | $this->crs = $crs; |
|
| 43 | 3 | } |
|
| 44 | |||
| 45 | 2 | public function getHeight(): Length |
|
| 48 | } |
||
| 49 | |||
| 50 | 1 | public function getCRS(): CoordinateReferenceSystem |
|
| 53 | } |
||
| 54 | |||
| 55 | 1 | public function calculateDistance(Point $to): Length |
|
| 56 | { |
||
| 57 | /* @var self $to */ |
||
| 58 | 1 | return new Metre(abs($this->height->asMetres()->getValue() - $to->height->asMetres()->getValue())); |
|
| 59 | } |
||
| 60 | |||
| 61 | 1 | public function __toString(): string |
|
| 64 | } |
||
| 65 | } |
||
| 66 |