src/Nfilin/Libs/InputData.php
protected function parseType(array $input)
    {
        /** @var string $type */
        /** @var string[] $types */
        extract($input);
        switch ($type) {
            case 'array':
                if (!is_array($this->{$key}))
                    return false;
                break;
            case 'int':
            case 'integer':
                if (!is_int($this->{$key}))
                    return false;
                break;
            case 'or':
                $valid = false;
                foreach ($types as $_type) {
                    if (gettype($this->{$key}) == $_type) {
                        $valid = true;
                        break;
                    }
                }
                if (!$valid) return false;
                break;
            default:
                //throw new Exception('Incorrect rule');
                return null;
        }
        return true;
    }
protected function parseType(array $input)
    {
        /** @var string $type */
        /** @var string[] $types */
        extract($input);
        switch ($type) {
            case 'array':
                if (!is_array($this->{$key}))
                    return false;
                break;
            case 'int':
            case 'integer':
                if (!is_int($this->{$key}))
                    return false;
                break;
            case 'or':
                $valid = false;
                foreach ($types as $_type) {
                    if (gettype($this->{$key}) == $_type) {
                        $valid = true;
                        break;
                    }
                }
                if (!$valid) return false;
                break;
            default:
                //throw new Exception('Incorrect rule');
                return null;
        }
        return true;
    }
protected function parseType ( array $ input ) { /** @var string $type */ /** @var string[] $types */ extract ( $ input ) ; switch ( $ type ) { case 'array' : if ( ! is_array ( $ this -> { $ key } ) ) return false ; break ; case 'int' : case 'integer' : if ( ! is_int ( $ this -> { $ key } ) ) return false ; break ; case 'or' : $ valid = false ; foreach ( $ types as $ _type ) { if ( gettype ( $ this -> { $ key } ) == $ _type ) { $ valid = true ; break ; } } if ( ! $ valid ) return false ; break ; default : //throw new Exception('Incorrect rule'); return null ; } return true ; }
Checks if field match type
@param array $input Array with result of [[parseRule()]]
@return boolean|null
Checks if field match type