| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 5 |
| 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_string($variableValue)) { |
|
| 25 | 1 | throw new InvalidStringException('variableValue', $variableValue); |
|
| 26 | 5 | } elseif (!is_int($from)) { |
|
| 27 | 1 | throw new InvalidIntException('from', $from); |
|
| 28 | 5 | } elseif (!is_int($to)) { |
|
| 29 | 1 | throw new InvalidIntException('to', $to); |
|
| 30 | } |
||
| 31 | |||
| 32 | 5 | parent::__construct( |
|
| 33 | 5 | sprintf( |
|
| 34 | 5 | 'Variable "$%s" must have length between "%d" and "%d", actual length: "%d"', |
|
| 35 | 5 | $variableName, |
|
| 36 | 5 | $from, |
|
| 37 | 5 | $to, |
|
| 38 | 5 | mb_strlen($variableValue) |
|
| 39 | 5 | ) |
|
| 40 | 5 | ); |
|
| 41 | } |
||
| 42 | } |