public final function detectFetchType($fetchType): int
    {
        switch (gettype($fetchType)) {
            case 'NULL':
                return ResultInterface::AS_OBJECT;
            case 'integer':
                if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC,
                    ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) {
                    return $fetchType;
                }
                break;
            case 'string':
                // shorthands
                if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC;
                if ($fetchType == 'object') return ResultInterface::AS_OBJECT;

                //  object, array_asc etc.
                $fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_'. strtoupper($fetchType);
                if (defined($fetchTypeConst)) {
                    return constant($fetchTypeConst);
                }

                // user classes
                if (class_exists($fetchType)) {
                    $this->setFetchObject($fetchType);

                    return ResultInterface::AS_OBJECT;
                }
                break;
        }

        throw new InvalidValueException("Given '{$fetchType}' fetch type is not implemented!");
    }
public final function detectFetchType($fetchType): int
    {
        switch (gettype($fetchType)) {
            case 'NULL':
                return ResultInterface::AS_OBJECT;
            case 'integer':
                if (in_array($fetchType, [ResultInterface::AS_OBJECT, ResultInterface::AS_ARRAY_ASC,
                    ResultInterface::AS_ARRAY_NUM, ResultInterface::AS_ARRAY_ASCNUM])) {
                    return $fetchType;
                }
                break;
            case 'string':
                // shorthands
                if ($fetchType == 'array') return ResultInterface::AS_ARRAY_ASC;
                if ($fetchType == 'object') return ResultInterface::AS_OBJECT;

                //  object, array_asc etc.
                $fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_'. strtoupper($fetchType);
                if (defined($fetchTypeConst)) {
                    return constant($fetchTypeConst);
                }

                // user classes
                if (class_exists($fetchType)) {
                    $this->setFetchObject($fetchType);

                    return ResultInterface::AS_OBJECT;
                }
                break;
        }

        throw new InvalidValueException("Given '{$fetchType}' fetch type is not implemented!");
    }
public final function detectFetchType ( $ fetchType ) : int { switch ( gettype ( $ fetchType ) ) { case 'NULL' : return ResultInterface :: AS_OBJECT ; case 'integer' : if ( in_array ( $ fetchType , [ ResultInterface :: AS_OBJECT , ResultInterface :: AS_ARRAY_ASC , ResultInterface :: AS_ARRAY_NUM , ResultInterface :: AS_ARRAY_ASCNUM ] ) ) { return $ fetchType ; } break ; case 'string' : // shorthands if ( $ fetchType == 'array' ) return ResultInterface :: AS_ARRAY_ASC ; if ( $ fetchType == 'object' ) return ResultInterface :: AS_OBJECT ; //  object, array_asc etc. $ fetchTypeConst = 'Oppa\Query\Result\ResultInterface::AS_' . strtoupper ( $ fetchType ) ; if ( defined ( $ fetchTypeConst ) ) { return constant ( $ fetchTypeConst ) ; } // user classes if ( class_exists ( $ fetchType ) ) { $ this -> setFetchObject ( $ fetchType ) ; return ResultInterface :: AS_OBJECT ; } break ; } throw new InvalidValueException ( "Given '{$fetchType}' fetch type is not implemented!" ) ; }
Detect fetch type.
@param  int|string $fetchType
@return int
@throws Oppa\Exception\InvalidValueException
Detect fetch type .