src/Validate.php
public static function validateCustomType($type, $value, $field_name, $model = [])
    {
        if (!isset(self::$custom_types[$type])) {
            throw new \Exception('type_not_found');
        }
        $callback = self::$custom_types[$type]['callback'];

        $output = false;

        if ($callback($value, $model, $output) === false) {
            //Incorrect
            throw new IncorrectParametersException([$field_name]);
        } else {
            //update output
            return $output;
        }
    }
public static function validateCustomType($type, $value, $field_name, $model = [])
    {
        if (!isset(self::$custom_types[$type])) {
            throw new \Exception('type_not_found');
        }
        $callback = self::$custom_types[$type]['callback'];

        $output = false;

        if ($callback($value, $model, $output) === false) {
            //Incorrect
            throw new IncorrectParametersException([$field_name]);
        } else {
            //update output
            return $output;
        }
    }
public static function validateCustomType ( $ type , $ value , $ field_name , $ model = [ ] ) { if ( ! isset ( self :: $ custom_types [ $ type ] ) ) { throw new \ Exception ( 'type_not_found' ) ; } $ callback = self :: $ custom_types [ $ type ] [ 'callback' ] ; $ output = false ; if ( $ callback ( $ value , $ model , $ output ) === false ) { //Incorrect throw new IncorrectParametersException ( [ $ field_name ] ) ; } else { //update output return $ output ; } }
Validate a custom data type.

This method uses previous custom-defined datatype to validate it's data.
@param string $type Custom type's name
@param mixed $value Value to test
@param string $field_name [optional] field's name
@param array $model [optional]
@throws \Exception type_not_found
@throws IncorrectParameters if validation fails
Validate a custom data type .