Passed
Push — 4.x ( c37faa...bd875a )
by Doug
12:53
created

Point   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAxisByName() 0 5 3
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord;
10
11
use PHPCoord\CoordinateReferenceSystem\CoordinateReferenceSystem;
12
use PHPCoord\CoordinateSystem\Axis;
13
14
abstract class Point implements \Stringable
15
{
16
    abstract public function getCRS(): CoordinateReferenceSystem;
17
18
    protected function getAxisByName(string $name): Axis
19
    {
20
        foreach ($this->getCRS()->getCoordinateSystem()->getAxes() as $axis) {
21
            if ($axis->getName() === $name) {
22
                return $axis;
23
            }
24
        }
25
    }
26
}
27