protected function validatePropertyType(string $property, string $type) : bool
    {
        list($type, $arg) = $this->parseType($type);

        switch ($type) {
            case 'any':
            case 'notnull':
            case 'isset':
            case 'set':
                return true;
            case 'string':
                return is_string($this->{$property});
            case 'email':
                return filter_var($this->{$property}, FILTER_VALIDATE_EMAIL) !== false;
            case 'url':
                return filter_var($this->{$property}, FILTER_VALIDATE_URL) !== false;
            case 'int':
                return is_int($this->{$property});
            case 'bool':
            case 'boolean':
                return is_bool($this->{$property});
            case 'array':
                return is_array($this->{$property});
            case 'null':
                return $this->{$property} === null;
            case 'is_a':
                return is_a($this->{$property}, $arg, true);
            case 'is':
                return is_a($this->{$property}, $arg);
            case 'instanceof':
                return $this->{$property} instanceof $arg;
            default:
                throw new \InvalidArgumentException("{$type} is not a recognised type");
        }
    }
protected function validatePropertyType(string $property, string $type) : bool
    {
        list($type, $arg) = $this->parseType($type);

        switch ($type) {
            case 'any':
            case 'notnull':
            case 'isset':
            case 'set':
                return true;
            case 'string':
                return is_string($this->{$property});
            case 'email':
                return filter_var($this->{$property}, FILTER_VALIDATE_EMAIL) !== false;
            case 'url':
                return filter_var($this->{$property}, FILTER_VALIDATE_URL) !== false;
            case 'int':
                return is_int($this->{$property});
            case 'bool':
            case 'boolean':
                return is_bool($this->{$property});
            case 'array':
                return is_array($this->{$property});
            case 'null':
                return $this->{$property} === null;
            case 'is_a':
                return is_a($this->{$property}, $arg, true);
            case 'is':
                return is_a($this->{$property}, $arg);
            case 'instanceof':
                return $this->{$property} instanceof $arg;
            default:
                throw new \InvalidArgumentException("{$type} is not a recognised type");
        }
    }
protected function validatePropertyType ( string $ property , string $ type ) : bool { list ( $ type , $ arg ) = $ this -> parseType ( $ type ) ; switch ( $ type ) { case 'any' : case 'notnull' : case 'isset' : case 'set' : return true ; case 'string' : return is_string ( $ this -> { $ property } ) ; case 'email' : return filter_var ( $ this -> { $ property } , FILTER_VALIDATE_EMAIL ) !== false ; case 'url' : return filter_var ( $ this -> { $ property } , FILTER_VALIDATE_URL ) !== false ; case 'int' : return is_int ( $ this -> { $ property } ) ; case 'bool' : case 'boolean' : return is_bool ( $ this -> { $ property } ) ; case 'array' : return is_array ( $ this -> { $ property } ) ; case 'null' : return $ this -> { $ property } === null ; case 'is_a' : return is_a ( $ this -> { $ property } , $ arg , true ) ; case 'is' : return is_a ( $ this -> { $ property } , $ arg ) ; case 'instanceof' : return $ this -> { $ property } instanceof $ arg ; default : throw new \ InvalidArgumentException ( "{$type} is not a recognised type" ) ; } }
Check property is valid against type

@param string $property
@param string $type
@return bool
Check property is valid against type