| Conditions | 4 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 2 | public function __invoke(string $password) : void |
|
| 30 | { |
||
| 31 | 2 | $length = (int) mb_strlen($password, $this->encoding); |
|
| 32 | |||
| 33 | 2 | if ($length < $this->min) { |
|
| 34 | 1 | throw InvalidLength::requires('min', $this->min, $length); |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | if ($this->max && $length > $this->max) { |
|
|
|
|||
| 38 | 1 | throw InvalidLength::requires('max', $this->max, $length); |
|
| 39 | } |
||
| 42 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: