Source of file AlphaNumericRule.php
Size: 0,876 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Validator/Rule/AlphaNumericRule.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Validator\Rule; /** * Check for alphanumeric character(s) * * @package Bluz\Validator\Rule */ class AlphaNumericRule extends AbstractCtypeRule { /** * Check for alphanumeric character(s) * * @param string $input * * @return bool */ protected function validateClean($input) : bool { return ctype_alnum($input); } /** * Get error template * * @return string */ public function getDescription() : string { if (empty($this->additionalChars)) { return __('must contain only letters and digits'); } return __('must contain only letters, digits and "%s"', $this->additionalChars); } } |