read a scalar value.

@param integer $type

@return string
343579
protected function generateReadScalarStatement($type)
    {
        $mapping = [
            Type::TYPE_INT32_VALUE    => '$reader->readVarint($stream)',
            Type::TYPE_INT64_VALUE    => '$reader->readVarint($stream)',
            Type::TYPE_UINT64_VALUE   => '$reader->readVarint($stream)',
            Type::TYPE_UINT32_VALUE   => '$reader->readVarint($stream)',
            Type::TYPE_DOUBLE_VALUE   => '$reader->readDouble($stream)',
            Type::TYPE_FIXED64_VALUE  => '$reader->readFixed64($stream)',
            Type::TYPE_SFIXED64_VALUE => '$reader->readSFixed64($stream)',
            Type::TYPE_FLOAT_VALUE    => '$reader->readFloat($stream)',
            Type::TYPE_FIXED32_VALUE  => '$reader->readFixed32($stream)',
            Type::TYPE_SFIXED32_VALUE => '$reader->readSFixed32($stream)',
            Type::TYPE_ENUM_VALUE     => '$reader->readVarint($stream)',
            Type::TYPE_SINT32_VALUE   => '$reader->readZigzag($stream)',
            Type::TYPE_SINT64_VALUE   => '$reader->readZigzag($stream)',
            Type::TYPE_BOOL_VALUE     => '$reader->readBool($stream)',
            Type::TYPE_STRING_VALUE   => '$reader->readString($stream)',
            Type::TYPE_BYTES_VALUE    => '$reader->readByteStream($stream)',
        ];

        if (isset($mapping[$type])) {
            return $mapping[$type];
        }

        throw new InvalidArgumentException('Unknown field type : ' . $type);
    }
729386
protected function _getInheritanceTypeString($type)
    {
        switch ($type) {
            case ClassMetadataInfo::INHERITANCE_TYPE_NONE:
                return 'NONE';

            case ClassMetadataInfo::INHERITANCE_TYPE_JOINED:
                return 'JOINED';

            case ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE:
                return 'SINGLE_TABLE';

            case ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS:
                return 'PER_CLASS';
        }
    }
1225150
protected function typeToString($type)
    {

        if (is_object($type)) {
            return sprintf('Object::%s', get_class($type));
        }

        if (is_array($type)) {
            $types = [];

            /** @noinspection ForeachSourceInspection */
            foreach ($type as $key => $item) {
                $types[] = sprintf('%s => %s', $key, $this->typeToString($item));
            }

            return 'Array(' . implode(', ', $types) . ')';
        }

        if (is_bool($type)) {
            return sprintf('Boolean::%s', $type ? 'True' : 'False');
        }

        if (is_int($type) || is_float($type)) {
            return sprintf('Integer::%s', (string) $type);
        }

        if ($type === null) {
            return 'null';
        }

        return "'$type'";
    }
84421
private function getLongTypeFromType(string $type): string
    {
        $reflection = new \ReflectionObject($this);
        foreach ($reflection->getConstants() as $const => $value) {
            if (0 === strpos($const, 'TYPE_')) {
                if ($type === $value) {
                    return strtolower(substr($const, 5));
                }
            }
        }

        return 'info';
    }
1167186
public static function getPhpType($type)
    {
        switch ($type) {
            case self::TYPE_DOUBLE:
            case self::TYPE_FLOAT:
                return 'float';
            case self::TYPE_INT64:
            case self::TYPE_UINT64:
            case self::TYPE_INT32:
            case self::TYPE_FIXED64:
            case self::TYPE_FIXED32:
            case self::TYPE_UINT32:
            case self::TYPE_SFIXED32:
            case self::TYPE_SFIXED64:
            case self::TYPE_SINT32:
            case self::TYPE_SINT64:
                return 'int';
            case self::TYPE_BOOL:
                return 'bool';
            case self::TYPE_STRING:
                return 'string';
            case self::TYPE_BYTES:
                return '\Protobuf\Stream';
            default:
                return null;
        }
    }
1107611
public static function getValue(string $type): string
    {
        switch ($type) {
            case '3':
                /* I18N: Quality of source information - GEDCOM tag “QUAY 3” */
                return I18N::translate('primary evidence');
            case '2':
                /* I18N: Quality of source information - GEDCOM tag “QUAY 2” */
                return I18N::translate('secondary evidence');
            case '1':
                /* I18N: Quality of source information - GEDCOM tag “QUAY 1” */
                return I18N::translate('questionable evidence');
            case '0':
                /* I18N: Quality of source information - GEDCOM tag “QUAY 0” */
                return I18N::translate('unreliable evidence');
            default:
                return $type;
        }
    }
1257531
private static function getTyped($type)
    {
        if (!isset(static::$types[$type])) {
            static::$types[$type] = new self($type);
        }

        return static::$types[$type];
    }
651830
protected function resolveType($type)
    {
        switch ($type) {
            case IndexMapping::TYPE_BOOLEAN:
                return ["type" => "boolean"];

            case IndexMapping::TYPE_FLOAT:
                return ["type" => "float"];

            case IndexMapping::TYPE_INTEGER:
                return ["type" => "integer"];

            case IndexMapping::TYPE_DATE:
                return ["type" => "date", "format" => "YYYY-MM-dd"];

            case IndexMapping::TYPE_DATETIME:
                return ["type" => "date"];

            case IndexMapping::TYPE_TIME:
                return ["type" => "date", "format" => "HH:mm:ss"];

            default:
            case IndexMapping::TYPE_STRING:
            case IndexMapping::TYPE_BIG_TEXT:
                return ["type" => "string", "analyzer" => "standard"];
        }
    }
16365
public function nextval($type = null) {
		$result = $this->getByType('nextval');
		if (!empty($type)) {
			return $result[$type];
		}
		return $result;
	}
563591
public static function getTypeDescription(?string $type): ?string
    {
        $descriptions = self::typeDescriptions();
        if (isset($descriptions[$type])) {
            return $descriptions[$type];
        }

        return $type;
    }
240495
private function getFromMemory($type)
    {
        if (isset($this->loaded[$type])) {
            return $this->loaded[$type];
        }
        return null;
    }
824161
public function resolveType($type)
    {
        if (is_numeric($type)) {
            return (int) $type;
        }

        $type = strtoupper($type);

        static $types = [
            'DOUBLE' => 1, 'STRING' => 2, 'OBJECT' => 3, 'ARRAY' => 4,
            'BINARY' => 5, 'ID' => 8, 'BOOL' => 8, 'BOOLEAN' => 8,
            'DATE' => 9, 'NULL' => 10, 'REGEX' => 11, 'JAVASCRIPT' => 13,
            'CODE' => 13, 'SYMBOL' => 14, 'JAVASCRIPT_SCOPE' => 15,
            'CODE_SCOPE' => 15, 'INT32' => 16, 'TS' => 17, 'TIMESTAMP' => 17,
            'INT64' => 18, 'MIN' => -1, 'MAX' => 127,
        ];

        if (! isset($types[$type])) {
            throw new \InvalidArgumentException('Type "'.$type.'" could not be resolved');
        }

        return $types[$type];
    }
755631
public static function getType($type)
    {
        if (!isset(static::$mappedTypeInstances[$type])) {
            if (!static::hasType($type)) {
                throw TypeException::typeDoesNotExist($type);
            }

            static::$mappedTypeInstances[$type] = new static::$mappedTypeClasses[$type]();
        }

        return static::$mappedTypeInstances[$type];
    }
900527
private function getDimensionedPrimitive($type)
    {
        if (null === $this->dimensions) {
            return $type;
        }

        if ($this->dimensions & (self::WKB_FLAG_Z | self::WKB_FLAG_M)) {
            return $type | $this->dimensions;
        }

        return $type + $this->dimensions;
    }
293768
protected function getDoctrineColumnType($type)
	{
		$type = strtolower($type);

		switch ($type) {
			case 'biginteger':
				$type = 'bigint';
				break;
			case 'smallinteger':
				$type = 'smallint';
				break;
			case 'mediumtext':
			case 'longtext':
				$type = 'text';
				break;
		}

		return Type::getType($type);
	}
484429
public function scalar($idx=0)
    {
        $row = $this->row();

        if(is_null($row))

            return NULL;

        $values = is_numeric($idx) ? array_values($row) : $row;

        return $values[$idx];
    }
380856
protected static function dataTypeToIndexField($type)
    {
        $key = '';
        $currentLang = LanguageHelper::getCurrent();
        switch ($type) {
            case Property::DATA_TYPE_STRING :
                $key = 'str_value_' . $currentLang;
                break;
            case Property::DATA_TYPE_TEXT :
                $key = 'txt_value_' . $currentLang;
                break;
            case Property::DATA_TYPE_BOOLEAN :
            case Property::DATA_TYPE_INTEGER :
                $key = 'value_integer';
                break;
            case Property::DATA_TYPE_FLOAT :
                $key = 'value_float';
                break;
            case Property::DATA_TYPE_INVARIANT_STRING :
            case Property::DATA_TYPE_PACKED_JSON :
                $key = 'utr_text';
                break;
        }
        return $key;
    }