public static function validate($type, $paramName, $data, array $params = [])
    {
        $data = (array) $data;
        switch ($type) {
            case self::VALIDATOR_USER:
                return static::validateByCallback($paramName, $data, $params);
            case self::VALIDATOR_EMAIL:
                return static::validateEmail($paramName, $data);
            case self::VALIDATOR_LENGTH:
                return static::validateLength($paramName, $data, $params);
            case self::VALIDATOR_EQUAL:
                return static::validateEquality($paramName, $data, $params);
            default:
                throw new \Exception('Unknown validator');
        }
    }
public static function validate($type, $paramName, $data, array $params = [])
    {
        $data = (array) $data;
        switch ($type) {
            case self::VALIDATOR_USER:
                return static::validateByCallback($paramName, $data, $params);
            case self::VALIDATOR_EMAIL:
                return static::validateEmail($paramName, $data);
            case self::VALIDATOR_LENGTH:
                return static::validateLength($paramName, $data, $params);
            case self::VALIDATOR_EQUAL:
                return static::validateEquality($paramName, $data, $params);
            default:
                throw new \Exception('Unknown validator');
        }
    }
public static function validate ( $ type , $ paramName , $ data , array $ params = [ ] ) { $ data = ( array ) $ data ; switch ( $ type ) { case self :: VALIDATOR_USER : return static :: validateByCallback ( $ paramName , $ data , $ params ) ; case self :: VALIDATOR_EMAIL : return static :: validateEmail ( $ paramName , $ data ) ; case self :: VALIDATOR_LENGTH : return static :: validateLength ( $ paramName , $ data , $ params ) ; case self :: VALIDATOR_EQUAL : return static :: validateEquality ( $ paramName , $ data , $ params ) ; default : throw new \ Exception ( 'Unknown validator' ) ; } }
Validate by type

@param string $type
@param string $paramName
@param array $data
@param array $params
@return mixed
@throws \Exception
Validate by type