| 1 | <?php |
||
| 7 | class StrlenMax extends AbstractStringCase implements SanitizeRuleInterface |
||
| 8 | { |
||
| 9 | /** @var int */ |
||
| 10 | protected $max; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @param int $max The maximum length. |
||
| 14 | */ |
||
| 15 | 27 | public function __construct(int $max) |
|
| 19 | |||
| 20 | /** |
||
| 21 | * Sanitizes a string to a maximum length by chopping it at the right. |
||
| 22 | * |
||
| 23 | * @param object $subject The subject to be filtered. |
||
| 24 | * @param string $field The subject field name. |
||
| 25 | * |
||
| 26 | * @return bool True if the value was sanitized, false if not. |
||
| 27 | */ |
||
| 28 | 27 | public function __invoke($subject, string $field): bool |
|
| 40 | } |
||
| 41 |