| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 13 |
| Ratio | 100 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 12 | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
|
| 42 | { |
||
| 43 | 12 | $length = extension_loaded('mbstring') ? |
|
| 44 | 12 | mb_strlen($instance, mb_detect_encoding($instance)) : |
|
| 45 | 12 | strlen($instance); |
|
| 46 | |||
| 47 | 12 | if ($length < $schema->minLength) { |
|
| 48 | 4 | $context->addViolation( |
|
| 49 | 4 | 'should be greater than or equal to %s characters', |
|
| 50 | 4 | [$schema->minLength] |
|
| 51 | 4 | ); |
|
| 52 | 4 | } |
|
| 53 | 12 | } |
|
| 54 | } |
||
| 55 |