2010-09-27 23:02:30 +02:00
|
|
|
<?php
|
2015-06-08 16:47:14 +02:00
|
|
|
|
2015-06-08 17:09:25 +02:00
|
|
|
/*
|
2023-02-17 05:13:51 +01:00
|
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
|
|
* SPDX-License-Identifier: MIT
|
2015-06-08 17:09:25 +02:00
|
|
|
*/
|
|
|
|
|
2017-11-19 19:01:31 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2010-09-27 23:02:30 +02:00
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
use function ctype_alnum;
|
2013-01-23 10:11:56 +01:00
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
/**
|
|
|
|
* Validates whether the input is alphanumeric or not.
|
|
|
|
*
|
|
|
|
* Alphanumeric is a combination of alphabetic (a-z and A-Z) and numeric (0-9)
|
|
|
|
* characters.
|
|
|
|
*
|
2023-02-13 05:59:06 +01:00
|
|
|
* @author Alexandre Gomes Gaigalas <alganet@gmail.com>
|
2018-09-03 22:42:38 +02:00
|
|
|
* @author Henrique Moody <henriquemoody@gmail.com>
|
|
|
|
* @author Nick Lombard <github@jigsoft.co.za>
|
|
|
|
*/
|
|
|
|
final class Alnum extends AbstractFilterRule
|
|
|
|
{
|
|
|
|
/**
|
2019-04-05 14:33:00 +02:00
|
|
|
* {@inheritDoc}
|
2018-09-03 22:42:38 +02:00
|
|
|
*/
|
2018-09-24 21:48:41 +02:00
|
|
|
protected function validateFilteredInput(string $input): bool
|
2013-01-22 21:08:55 +01:00
|
|
|
{
|
2013-01-22 06:15:57 +01:00
|
|
|
return ctype_alnum($input);
|
|
|
|
}
|
2011-02-10 21:49:48 +01:00
|
|
|
}
|