Source of file NoWhitespaceRule.php
Size: 0,642 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Validator/Rule/NoWhitespaceRule.php
12345678910111213141516171819202122232425262728293031323334353637 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Validator\Rule; /** * Check for no whitespaces * * @package Bluz\Validator\Rule */ class NoWhitespaceRule extends AbstractRule { /** * @var string error template */ protected $description = 'must not contain whitespace'; /** * Check input data * * @param string $input * * @return bool */ public function validate($input): bool { return is_null($input) || !preg_match('/\s/', (string)$input); } } |