Conditions | 5 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | 5 | public function __construct($variableName, $variableValue, $count) |
|
23 | { |
||
24 | 5 | if (!is_string($variableName)) { |
|
25 | 1 | throw new InvalidStringException('variableName', $variableName); |
|
26 | 4 | } elseif (!is_array($variableValue)) { |
|
27 | 1 | throw new InvalidArrayException('variableValue', $variableValue); |
|
28 | 3 | } elseif (!is_int($count)) { |
|
29 | 1 | throw new InvalidIntException('count', $count); |
|
30 | 3 | } elseif ($count < 0) { |
|
31 | 1 | throw new NumberNotGreaterException('count', $count, 0); |
|
32 | } |
||
33 | |||
34 | 2 | parent::__construct( |
|
35 | 2 | sprintf( |
|
36 | 2 | 'Variable "$%s" must contain: "%d" elements, actual count: "%d"', |
|
37 | 2 | $variableName, |
|
38 | 2 | $count, |
|
39 | 2 | count($variableValue) |
|
40 | 2 | ) |
|
41 | 2 | ); |
|
42 | 2 | } |
|
43 | } |
||
44 |