* * For the full copyright and license information, please view the LICENSE file * that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Validation\Rules; use function ctype_digit; use function is_int; /** * Validates if the input is an integer. * * @author Adam Benson * @author Alexandre Gomes Gaigalas * @author Andrei Drulchenko * @author Danilo Benevides * @author Henrique Moody */ final class IntVal extends AbstractRule { /** * {@inheritDoc} */ public function validate($input): bool { if (is_int($input)) { return true; } return ctype_digit($input); } }