Conditions | 8 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
20 | 6 | public function __construct($variableName, $variableValue, $from, $to) |
|
21 | { |
||
22 | 6 | if (!is_string($variableName)) { |
|
23 | 1 | throw new InvalidStringException('variableName', $variableName); |
|
24 | 5 | } elseif (!is_int($variableValue) && !is_float($variableValue)) { |
|
25 | 1 | throw new InvalidIntOrFloatException('variableValue', $variableValue); |
|
26 | 5 | } elseif (!is_int($from) && !is_float($from)) { |
|
27 | 1 | throw new InvalidIntOrFloatException('from', $from); |
|
28 | 5 | } elseif (!is_int($to) && !is_float($to)) { |
|
29 | 1 | throw new InvalidIntOrFloatException('to', $to); |
|
30 | } |
||
31 | |||
32 | 5 | parent::__construct( |
|
33 | 5 | sprintf( |
|
34 | 5 | 'Variable "$%s" must be strictly between "%s" and "%s", actual value: "%s"', |
|
35 | 5 | $variableName, |
|
36 | 5 | (string) $from, |
|
37 | 5 | (string) $to, |
|
38 | (string) $variableValue |
||
39 | 5 | ) |
|
40 | 5 | ); |
|
41 | } |
||
42 | } |