| Conditions | 5 | 
| Paths | 4 | 
| Total Lines | 19 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 9 | 
| CRAP Score | 5.025 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 27 | 27 | public function __invoke($subject, string $field): bool | |
| 28 |     { | ||
| 29 | 27 | $value = $subject->$field; | |
| 30 | |||
| 31 | 27 |         if (!is_scalar($value)) { | |
| 32 | 3 | return false; | |
| 33 | } | ||
| 34 | |||
| 35 | 24 | $hex = ctype_xdigit($value); | |
| 36 | 24 |         if (!$hex) { | |
| 37 | 12 | return false; | |
| 38 | } | ||
| 39 | |||
| 40 | 12 |         if ($this->max && strlen($value) > $this->max) { | |
| 41 | return false; | ||
| 42 | } | ||
| 43 | |||
| 44 | 12 | return true; | |
| 45 | } | ||
| 46 | } | ||
| 47 |