Passed
Push — 4.x ( e9b635...bc20e1 )
by Doug
07:44
created

InvalidAxesException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * PHPCoord.
4
 *
5
 * @author Doug Wright
6
 */
7
declare(strict_types=1);
8
9
namespace PHPCoord\Exception;
10
11
use function implode;
12
use PHPCoord\CoordinateSystem\Axis;
13
use UnexpectedValueException;
14
15
class InvalidAxesException extends UnexpectedValueException
16
{
17
    /**
18
     * InvalidAxesException constructor.
19
     * @param Axis[] $allowedAxes
20
     */
21 2
    public function __construct(array $allowedAxes)
22
    {
23 2
        $axisNames = array_map(static function ($allowedAxis) {
24 2
            return $allowedAxis->getName();
25 2
        }, $allowedAxes);
26
27 2
        parent::__construct('This CRS has axes: ' . implode(', ', $axisNames));
28 2
    }
29
}
30