Source of file InStrictRule.php
Size: 0,820 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Validator/Rule/InStrictRule.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Validator\Rule; /** * Check for value in set * * @package Bluz\Validator\Rule */ class InStrictRule extends InRule { /** * Check input data * * @param string $input * * @return bool */ public function validate($input): bool { if (is_array($this->haystack)) { return in_array($input, $this->haystack, true); } if (!is_string($this->haystack)) { return false; } if (empty($input)) { return false; } $enc = mb_detect_encoding($input); return mb_strpos($this->haystack, $input, 0, $enc) !== false; } } |