Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
25 | 23 | public function __construct(array $values) |
|
26 | { |
||
27 | 23 | if (!isset($values['value'])) { |
|
28 | 1 | throw new \InvalidArgumentException('No API version provided'); |
|
29 | } |
||
30 | |||
31 | 22 | $stringifiedValue = (string) $values['value']; |
|
32 | |||
33 | 22 | if (!preg_match('/^\d{1,}(?:\.\d{1,}){0,1}$/', $stringifiedValue)) { |
|
34 | 4 | throw new \InvalidArgumentException('API version must have X or X.X format'); |
|
35 | } |
||
36 | |||
37 | 18 | $this->apiVersion = $stringifiedValue; |
|
38 | 18 | } |
|
39 | |||
48 |