src/BaseValidator.php
public static function registerValidator($type, $className)
    {
        if (!is_string($type)) {
            throw new \Exception('"type" MUST be string');
        }

        if (!is_string($className)) {
            throw new \Exception('"className" MUST be string');
        }

        if (!is_subclass_of(
            $className,
            BaseValidator::class,
            true
        )) {
            throw new \Exception(sprintf(
                '"className" MUST extend "%s"',
                BaseValidator::class
            ));
        }

        self::$validatorRegistry[$type] = $className;
    }
public static function registerValidator($type, $className)
    {
        if (!is_string($type)) {
            throw new \Exception('"type" MUST be string');
        }

        if (!is_string($className)) {
            throw new \Exception('"className" MUST be string');
        }

        if (!is_subclass_of(
            $className,
            BaseValidator::class,
            true
        )) {
            throw new \Exception(sprintf(
                '"className" MUST extend "%s"',
                BaseValidator::class
            ));
        }

        self::$validatorRegistry[$type] = $className;
    }
public static function registerValidator ( $ type , $ className ) { if ( ! is_string ( $ type ) ) { throw new \ Exception ( '"type" MUST be string' ) ; } if ( ! is_string ( $ className ) ) { throw new \ Exception ( '"className" MUST be string' ) ; } if ( ! is_subclass_of ( $ className , BaseValidator :: class , true ) ) { throw new \ Exception ( sprintf ( '"className" MUST extend "%s"' , BaseValidator :: class ) ) ; } self :: $ validatorRegistry [ $ type ] = $ className ; }
Register a custom validator for a type
@param  string $type      Type's name, `x-` SHOULD be used for custom types
@param  string $className Validator's full classname.
All validators MUST extend `BaseValidator` class
@example
```php
BaseValidator::registerValidator('x-address', 'My\APP\AddressValidator');
```
@throws \Exception
Register a custom validator for a type