| Total Complexity | 3 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | trait Length |
||
| 22 | { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Checks the min Length |
||
| 26 | * @param string $field |
||
| 27 | * @param string $value |
||
| 28 | * @param int $minLength |
||
| 29 | * @return bool |
||
| 30 | */ |
||
| 31 | protected function minLen(string $field, string $value, int $minLength): bool |
||
|
|
|||
| 32 | { |
||
| 33 | return mb_strlen($value) >= $minLength; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Checks the max Length |
||
| 38 | * @param string $field |
||
| 39 | * @param string $value |
||
| 40 | * @param int $maxLength |
||
| 41 | * @return bool |
||
| 42 | */ |
||
| 43 | protected function maxLen(string $field, string $value, int $maxLength): bool |
||
| 44 | { |
||
| 45 | return mb_strlen($value) <= $maxLength; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Checks the exact length |
||
| 50 | * @param string $field |
||
| 51 | * @param string $value |
||
| 52 | * @param int $exactLength |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | protected function exactLen(string $field, string $value, int $exactLength): bool |
||
| 58 | } |
||
| 59 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.