Gets the php standard type identifier for a variable type.
@todo Add hook|signal so a plugin can modify the returned type.
@param \Peg\Lib\Definitions\Element\VariableType $type
779704
public function GetPHPStandardType(
        \Peg\Lib\Definitions\Element\VariableType $type
    )
    {
        $standard_type = $this->GetStandardType($type);
        $php_type = "";

        switch($standard_type)
        {
            case StandardType::BOOLEAN:
                $php_type .= "bool";
                break;

            case StandardType::INTEGER:
                $php_type .= "int";
                break;

            case StandardType::REAL:
                $php_type .= "float";
                break;

            case StandardType::CHARACTER:
                $php_type .= "string";
                break;

            case StandardType::VOID:
                $php_type .= "void";
                break;

            case StandardType::OBJECT:
                $php_type .= $type->type;
                break;
            
            case StandardType::CLASS_ENUM:
                $php_type .= $type->type . "| int";
                break;
            
            case StandardType::ENUM:
                $php_type .= "int";
                break;
            
            case StandardType::UNKNOWN:
                $php_type .= "unknown";
                break;
        }
        
        return $php_type;
    }
1297727
private function lookupEntityName($type)
    {
        $module = $this->moduleManager->getModule($type);

        if (!$module instanceof NodeModuleInterface) {
            throw new \Exception(sprintf('Type "%s" is not a NodeModule.', $type));
        }

        return $module->getEntityName();
    }
271191
private function getIdGenerator($type)
    {
        if (!isset($this->idGenerators[$type])) {
            $this->idGenerators[$type] = IdGenerator::create($type);
        }

        return $this->idGenerators[$type];
    }
402558
protected function createDescriptorForType($type)
    {
        if (!$this->isArrayNotation($type)) {
            $className = $this->findClassNameForType($type);

            return $className ? new $className() : new UnknownTypeDescriptor($type);
        }

        $type       = $this->extractTypeFromArrayNotation($type);
        $className  = $this->findClassNameForType($type);
        $descriptor = $className ? new $className() : new UnknownTypeDescriptor($type);
        $descriptor = $this->convertToArrayDescriptor($descriptor);

        return $descriptor;
    }
413949
protected function getType($type)
    {
        if (isset($this->typeAlias[$type])) {
            return $this->typeAlias[$type];
        }

        return $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';
        }
    }
244285
protected function getIdGeneratorTypeString($type)
    {
        if ( ! isset(static::$generatorStrategyMap[$type])) {
            throw new \InvalidArgumentException(sprintf('Invalid provided IdGeneratorType: %s', $type));
        }

        return static::$generatorStrategyMap[$type];
    }
1257531
private static function getTyped($type)
    {
        if (!isset(static::$types[$type])) {
            static::$types[$type] = new self($type);
        }

        return static::$types[$type];
    }
527793
protected function _getIdGeneratorTypeString($type)
    {
        switch ($type) {
            case ClassMetadataInfo::GENERATOR_TYPE_AUTO:
                return 'AUTO';

            case ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE:
                return 'SEQUENCE';

            case ClassMetadataInfo::GENERATOR_TYPE_TABLE:
                return 'TABLE';

            case ClassMetadataInfo::GENERATOR_TYPE_IDENTITY:
                return 'IDENTITY';

            case ClassMetadataInfo::GENERATOR_TYPE_UUID:
                return 'UUID';

            case ClassMetadataInfo::GENERATOR_TYPE_CUSTOM:
                return 'CUSTOM';
        }
    }
260648
public function getClassForType(string $type):?string
    {
        if (isset($this->typeMap[$type])) {
            return $this->typeMap[$type];
        }

        return null;
    }
1266703
public function getXMLDBTypeName($type) {

        $result = "";

        switch (strtolower($type)) {
            case XMLDB_TYPE_INTEGER:
                $result = 'int';
                break;
            case XMLDB_TYPE_NUMBER:
                $result = 'number';
                break;
            case XMLDB_TYPE_FLOAT:
                $result = 'float';
                break;
            case XMLDB_TYPE_CHAR:
                $result = 'char';
                break;
            case XMLDB_TYPE_TEXT:
                $result = 'text';
                break;
            case XMLDB_TYPE_BINARY:
                $result = 'binary';
                break;
            case XMLDB_TYPE_DATETIME:
                $result = 'datetime';
                break;
        }
        // Return the normalized name
        return $result;
    }
1029683
public function getNextOfType($type)
    {
        for (; $this->idx < $this->count; ++$this->idx) {
            if ($this->tokens[$this->idx]->type === $type) {
                return $this->tokens[$this->idx++];
            }
        }

        return null;
    }
435529
protected function getValidatorType($type)
    {
        switch ($type) {
            case 'int':
                $type = 'Integer';
                break;
            case 'bool':
                $type = 'Boolean';
                break;
            case 'double':
                $type = 'Float';
                break;
            case 'numeric':
                $type = 'Number';
                break;
            case 'mixed':
                $type = 'Raw';
                break;
            default:
                $type = ucfirst($type);
        }
        return $type;
    }
354454
public static function getTypeName($type)
	{
		static $ref = [];
		
		$key = static::class;
		
		if(empty($ref[$key]))
		{
			$ref[$key] = new \ReflectionClass($key);
		}
		
		foreach($ref[$key]->getConstants() as $k => $v)
		{
			if($v === $type && strpos($k, 'T_') === 0)
			{
				return $k;
			}
		}

		return static::UNKNOWN;
	}
6533
public static function typeToString($type)
    {
        switch ($type) {
            case self::EOF_TYPE:
                return 'EOF';
            case self::BANG_TYPE:
                return '!';
            case self::DOLLAR_TYPE:
                return '$';
            case self::PAREN_L_TYPE:
                return '(';
            case self::PAREN_R_TYPE:
                return ')';
            case self::SPREAD_TYPE:
                return '...';
            case self::COLON_TYPE:
                return ':';
            case self::EQUALS_TYPE:
                return '=';
            case self::AT_TYPE:
                return '@';
            case self::BRACKET_L_TYPE:
                return '[';
            case self::BRACKET_R_TYPE:
                return ']';
            case self::BRACE_L_TYPE:
                return '{';
            case self::PIPE_TYPE:
                return '|';
            case self::BRACE_R_TYPE:
                return '}';
            case self::NAME_TYPE:
                return 'Name';
            case self::VARIABLE_TYPE:
                return 'Variable';
            case self::INT_TYPE:
                return 'Int';
            case self::FLOAT_TYPE:
                return 'Float';
            case self::STRING_TYPE:
                return 'String';
            default:
                throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type));
        }
    }
1062778
public function getXSDType($type)
    {
        if ($this->isXDSType($type)) {
            return self::$XSDTypes[strtolower($type)];
        } elseif ($type) {
            if (strpos($type, '[]')) {
                if ($this->isXDSType(str_replace('[]', '', $type))) {
                    return self::$XSDTypes['array'];
                }
            }

            return $this->addComplexType($type);
        } else {
            return null;
        }
    }
250460
private function getTypeSuffix($type)
    {
        self::$TYP_MAPPING = array_merge(self::$TYP_COMPLEX_MAPPING, self::$TYP_SIMPLE_MAPPING);

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

        if (!isset(self::$TYP_MAPPING[$this->type])) {
            return '';
        }

        return self::$TYP_MAPPING[$this->type];
    }