Jyxo\Input\Validator::__callStatic PHP Method

__callStatic() public static method

Static validation.
public static __callStatic ( string $method, array $params ) : boolean
$method string Validator name
$params array Parameters; the first value gets validated, the rest will be used as constructor parameters
return boolean
    public static function __callStatic(string $method, array $params)
    {
        try {
            $factory = \Jyxo\Spl\ObjectCache::get(\Jyxo\Input\Factory::class) ?: \Jyxo\Spl\ObjectCache::set(\Jyxo\Input\Factory::class, new Factory());
            $value = array_shift($params);
            $key = 'Jyxo\\Input\\Validator\\' . ucfirst($method) . ($params ? '/' . serialize($params) : '');
            $validator = \Jyxo\Spl\ObjectCache::get($key) ?: \Jyxo\Spl\ObjectCache::set($key, $factory->getValidatorByName($method, $params));
        } catch (\Exception $e) {
            $validator = $factory->getValidatorByName($method, $params);
        }
        return $validator->isValid($value);
    }
Validator