Full ASCII; 0-127.

NB: Returns true on empty ('') string.

@see Validate::string()

@param mixed $subject
Checked stringified.

@return bool
True on empty.
439493
public function ascii($subject) : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return $v === '' ? true : !!preg_match('/^[[:ascii:]]+$/', $v);
    }
980205
public function loadHexString(Color $color, $subject)
    {
        $subject = trim($subject);

        $subject = str_replace(array('#', ';', ' '), '', $subject);

        if (strlen($subject) !== 3 && strlen($subject) !== 6) {
            //Bad Input
            return false;
        } elseif (strlen($subject) === 3) {
            $subject = $subject[0] . $subject[0] .
                       $subject[1] . $subject[1] .
                       $subject[2] . $subject[2] ;
        }

        $color->hex = $subject;

        return $color;
    }
289543
public function maxLength($subject, int $max) : bool
    {
        if ($subject === null) {
            return false;
        }
        if ($max < 0) {
            throw new InvalidArgumentException('Arg max[' . $max . '] is not non-negative.');
        }
        return strlen('' . $subject) <= $max;
    }
834413
public static function strrev($s)
	{
		if (! ReflectionTypeHint::isValid()) return false;
		if (is_null($s)) return $s;

		if (0) #TODO test speed
		{
			$s = self::_convert($s, 'UTF-8', 'UTF-32');
			if (! is_string($s)) return false;
			$s = implode('', array_reverse(str_split($s, 4)));
			return self::_convert($s, 'UTF-32', 'UTF-8');
		}

		if (! is_array($a = self::str_split($s))) return false;
		return implode('', array_reverse($a));
	}
736647
public function validate($subject): bool
    {
        $nodeValidator = new NodeValidator($this->rootSchema, $this->rootSchema);
        return $nodeValidator->validate($subject);
    }
1157004
protected function containsObject($subject)
    {
        if (is_object($subject)) {
            return true;
        }
        if (!is_array($subject)) {
            return false;
        }
        foreach ($subject as $value) {
            if ($this->containsObject($value)) {
                return true;
            }
        }
        return false;
    }
1174179
public function validate($subject): bool
    {
        if (\is_numeric($this->schema['exclusiveMinimum'])) {
            if ($subject <= $this->schema['exclusiveMinimum']) {
                return false;
            }
        }
        return true;
    }
100636
public function match($subject)
    {
        $this->subject = $subject;

        $suffixLength = strlen($this->suffix);
        if (!$suffixLength) {
            return true;
        }

        return (substr($subject, -$suffixLength) === $this->suffix);
    }
1066046
private function validateTypeArray($subject): bool
    {
        if (!\is_array($subject)) {
            return false;
        }
        if (count($subject) > 0 && !\is_int(\array_keys($subject)[0])) {
            return false;
        }
        return true;
    }
470266
public static function match(string $subject, string $pattern, int $flags = 0, int $offset = 0)
    {
        if ($offset > \strlen($subject)) {
            return null;
        }

        $m = null;

        return static::pcre('\preg_match', [$pattern, $subject, &$m, $flags, $offset])
            ? $m
            : null;
    }
856649
public function plainText($subject) : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return $v === '' ? true : !strcmp($v, strip_tags($v));
    }
593182
public static function ToSnakeCase ($subject, $trim = true) {
		$subject = Regex::ReplaceCallback(
			"/([A-Z])/",
			function ($matches) {return '_'. strtolower($matches[1]);},
			$subject
		);
		return ($trim) ? ltrim($subject, '_') : $subject;
	}
862316
public function url($subject) : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return $v === '' ? false : !!filter_var($v, FILTER_VALIDATE_URL);
    }
648707
public function _preg_replace($subject, $pattern, $replacement = '', $limit = -1)
    {
        if (!isset($subject)) {
            return;
        } else {
            return preg_replace($pattern, $replacement, $subject, $limit);
        }
    }
1194129
public function keyedArray($subject) : bool
    {
        if (!is_array($subject)) {
            return false;
        }
        if (!$subject) {
            return true;
        }
        return !ctype_digit(join('', array_keys($subject)));
    }
946910
public function validate($subject): bool
    {
        $nodeValidator = new NodeValidator($this->schema['not'], $this->rootSchema);
        if ($nodeValidator->validate($subject)) {
            return false;
        }
        return true;
    }
32312
public function match(Subject $subject, string $verb): bool
    {
        return $this->subject->getType() == $subject->getType() &&
            $this->subject->getId() === $subject->getId() &&
            ($this->verbs === null || in_array($verb, $this->verbs, true));
    }