mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 23:35:45 +01:00
Since the library doesn't need to give support to version 5.4 or less of PHP using variadics in the constructor of "AbstractFilterRule" seems better than doing the whole validation. This commit will also apply the contribution guidelines to "AbstractFilterRule" and use a better naming for it. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
34 lines
768 B
PHP
34 lines
768 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Respect/Validation.
|
|
*
|
|
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
*
|
|
* For the full copyright and license information, please view the "LICENSE.md"
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use function ctype_digit;
|
|
|
|
/**
|
|
* Validates whether the input contains only digits.
|
|
*
|
|
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
* @author Nick Lombard <github@jigsoft.co.za>
|
|
*/
|
|
final class Digit extends AbstractFilterRule
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function validateFilteredInput(string $input): bool
|
|
{
|
|
return ctype_digit($input);
|
|
}
|
|
}
|