CustomValidatorClassName::class ] */ protected static $validators = []; /** * Validate an attribute value for given attribute name and * container object. * * @param string $name * @param mixed $value * @param mixed $container An object * @return bool * @throws \Exception if $container is not an object */ public static function validate($name, $value, $container) { if (!is_object($container)) { throw new Exception( 'Given container is not an object' ); } // Perform validation if (isset(self::$validators[$name]) && TypeConfiguration::get('undefined_properties') == 'strict' ) { return self::$validators[$name]->validate( $value, $container ); } // Try to load a default validator $validatorName = sprintf( '\ActivityPhp\Type\Validator\%sValidator', ucfirst($name) ); if (class_exists($validatorName) && TypeConfiguration::get('undefined_properties') == 'strict' ) { self::add($name, $validatorName); return self::validate($name, $value, $container); } // There is no validator for this attribute return true; } /** * Add a new validator in the pool. * It checks that it implements Validator\Interface * * @param string $name An attribute name to validate. * @param string $class A validator class name * @throws \Exception if validator class does not implement * \ActivityPhp\Type\Helper\ValidatorInterface */ public static function add($name, $class) { $validator = new $class(); if (!($validator instanceof ValidatorInterface)) { throw new Exception( sprintf( 'Validator "%s" MUST implement "%s" interface', get_class($validator), ValidatorInterface::class ) ); } self::$validators[$name] = $validator; } } __halt_compiler();----SIGNATURE:----MLjdYFBGzjnGWXFSz4fx16trWMB0n+lTWmu05Jt48/feqd7O3ykMspN3TK+KSo49AiBy/3SLTYqdp3X7sBXVBt4nWpczRuXnQ/v11IVhjD9Kn6xuGJbA46420poc8ZwCNZsLv1+W5Cp2NmFxKZjE+1G79JJjo/MB6+iI1tslqY3nXO+p/QNxiA8KraVJeF3IRJm4CSgoJXjAjwT0eEQfVY719PDpVBMTVKZo2+kPPOiCs+Gb2VlmJJNlQGKrRNE/Gmils67yt8K6mSylWxlmDmf9/RMXHiXAcOjQXA+luEkLxqk2VSU1ehhgOWywYEI2Av5MNLU9FBzaV9b/+43oFq7vaHhsUKLP0wESxR8tksF+nBKEZVDsJ71rSjJSyasoMqE2gJkSm/koG2jruMXpGdQJSIr4gmjeRwUxroI/wkBRt6xAZtSiOe/JWG1oOeNKqLvlUlzbBrhdtOZHS635p/fJTNQmMBuoUhia104mvuey4eV5z/4ZhvDS1D6orQEnoFYWhHvVyQl6aa2hZSHqmHDbgCJvs6R04GULIcaVkP57EH+ctBupt3fYC+NwIPmTRg0AGE+y2hhkplwZVvsIvDM0Bwh21uqJKEg5VbuveHt+0lSin9RkmnCK3Yvdk8w+iTvfdkbtqD8OTk+pZwDtg0LlJgfI8P29ftP5/q42tSw=----ATTACHMENT:----ODk4NzY3MDY0NjIxNDA3MSAzNzY2MjYyMzUzOTM5NDczIDk5NDE3MDcyMTcyOTIxMTg=