mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 15:50:03 +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>
37 lines
867 B
PHP
37 lines
867 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_alnum;
|
|
|
|
/**
|
|
* Validates whether the input is alphanumeric or not.
|
|
*
|
|
* Alphanumeric is a combination of alphabetic (a-z and A-Z) and numeric (0-9)
|
|
* characters.
|
|
*
|
|
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
* @author Nick Lombard <github@jigsoft.co.za>
|
|
*/
|
|
final class Alnum extends AbstractFilterRule
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function validateFilteredInput(string $input): bool
|
|
{
|
|
return ctype_alnum($input);
|
|
}
|
|
}
|