@param string $typeName 类型名称
@param array $use 引入的类名
@param string $nameSpace 命名空间

@return TypeModel
164573
public function setTypeName(string $typeName, array $use = [], string $nameSpace = ''): TypeModel
    {
        $types = ['string', 'int', 'float', 'array', 'bool', 'callable'];
        $this->typeName = $typeName;
        if (!in_array($typeName, $types) && strpos($typeName, '|') === false) {
            foreach ($use as $item) {
                $items = explode('\\', $item);
                $className = array_pop($items);
                if ($className == $typeName) {
                    $this->setClassName('\\'.$item);
                    break;
                }
            }
            if (!$this->getClassName()) {
                if (strpos($typeName, '\\') !== false) {
                    $this->setClassName($typeName);
                } else {
                    $this->setClassName($nameSpace.'\\'.$typeName);
                }
            }
        }

        return $this;
    }
621493
protected function createGetter($name, Type $type, $namespace)
    {
        return new Stmt\ClassMethod(
            // getProperty
            $this->getNaming()->getPrefixedMethodName('get', $name),
            [
                // public function
                'type' => Stmt\Class_::MODIFIER_PUBLIC,
                'stmts' => [
                    // return $this->property;
                    new Stmt\Return_(
                        new Expr\PropertyFetch(new Expr\Variable('this'), $this->getNaming()->getPropertyName($name))
                    ),
                ],
            ], [
                'comments' => [$this->createGetterDoc($type, $namespace)],
            ]
        );
    }
334154
protected function createSetterDoc($name, Type $type, $namespace)
    {
        return new Doc(sprintf(<<<EOD
/**
 * @param %s %s
 *
 * @return self
 */
EOD
        , $type->getDocTypeHint($namespace), '$'.$this->getNaming()->getPropertyName($name)));
    }
711922
public static function generateServiceName($name, $namespace, $type)
    {
        return $namespace.
            self::NAME_SPACE_SEPARATOR.
            $name.
            self::NAME_SPACE_SEPARATOR.
            $type.
            self::NAME_SPACE_SEPARATOR.
            self::QUEUE_SUFFIX;
    }
185486
private function getRegionZonesByTypeName($typeName)
    {
        return $this->getRegionZones()->filter(
            function($regionZone) use ($typeName) {
                return $regionZone->getType()->getName() === $typeName;
            }
        );
    }
960430
public function withNameSpace($namespace)
    {
        $namespace = (string) $namespace;

        if (! isset(static::$namespaces[$namespace])) {
            $new = clone $this;
            $new->setNamespace($namespace);
            $new->setEnabled($this->enabled);
            static::$namespaces[$namespace] = $new;
        }

        return static::$namespaces[$namespace];
    }
741275
public function bind($typeName)
	{
		if($this->proxyTypes !== NULL)
		{
			$this->proxyTypes = NULL;
		}
		
		$key = strtolower($typeName);
		
		switch($key)
		{
			case 'koolkode\config\configuration':
			case 'koolkode\context\containerinterface':
			case 'koolkode\context\exposedcontainerinterface':
			case 'koolkode\context\scope\scopedcontainerinterface':
				throw new \InvalidArgumentException(sprintf('Binding %s is forbidden', $typeName));
		}
		
		if(isset($this->bindings[$key]))
		{
			return $this->bindings[$key];
		}
		
		return $this->bindings[$key] = new Binding($typeName);
	}
229788
public function valueAlignmentForNamespace( $namespace, $name )
	{
		$prefix = "";

		switch ( $namespace )
		{
			case "http://xbrl.sec.gov/dei/2014-01-31":

				$prefix = "dei";
				break;

			case 'http://fasb.org/us-types/2014-01-31':
				$prefix = "us-types";
				break;

			default:
				return parent::valueAlignmentForNamespace( $namespace, $name );
		}

		$type = "$prefix:$name";

		switch ( $type )
		{
			case 'us-types:dateStringItemType':
			case 'dei:fiscalPeriodItemType':
			case 'dei:submissionTypeItemType':
			case 'dei:centralIndexKeyItemType':
			case 'dei:yesNoItemType':
			case 'dei:filerCategoryItemType':
			default:
				return "left";
		}

	}
1230889
public function create(string $className, string $typeName): Type
    {
        $type = new InputObjectType([
            'name' => $typeName,
            'fields' => function () use ($className, $typeName): array {
                $fieldsEnum = new EnumType([
                    'name' => $typeName . 'Field',
                    'values' => $this->getPossibleValues($className),
                    'description' => 'Fields available for `' . $typeName . '`',
                ]);
                $this->types->registerInstance($fieldsEnum);

                return [
                    [
                        'name' => 'field',
                        'type' => Type::nonNull($fieldsEnum),
                    ],
                    [
                        'name' => 'nullAsHighest',
                        'type' => Type::boolean(),
                        'description' => 'If true `NULL` values will be considered as the highest value, so appearing last in a `ASC` order, and first in a `DESC` order.',
                        'defaultValue' => false,
                    ],
                    [
                        'name' => 'order',
                        'type' => $this->types->get('SortingOrder'),
                        'defaultValue' => 'ASC',
                    ],
                ];
            },
        ]);

        return $type;
    }
643635
protected function definitionsByType(string $typeClassName): Collection
    {
        return $this->definitionMap
            ->filter(function (Node $node) use ($typeClassName) {
                return $node instanceof $typeClassName;
            });
    }
383593
public function AddTypeDef(
        \Peg\Lib\Definitions\Element\TypeDef $typedef, 
        $namespace = "\\"
    )
    {
        $this->CreateNamespace($namespace);
        
        $typedef->header =& $this;
        $typedef->namespace =& $this->namespaces[$namespace];

        $this->namespaces[$namespace]
            ->type_definitions[$typedef->name] = $typedef
        ;
    }
526715
public function findByNamespace($namespace)
    {
        if (!$this->hasPlugin($namespace)) {
            return null;
        }

        $classId = $this->getIdentifier($namespace);

        return $this->plugins[$classId];
    }
56111
public static function loadCustom($classname, $namespace, $name) {

		if(false === is_string($classname)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($classname)), E_USER_ERROR);
		}

		if(false === is_string($namespace)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($namespace)), E_USER_ERROR);
		}

		if(false === is_string($name)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($name)), E_USER_ERROR);
		}

		static :: $custom[$name] = $namespace;

		return static :: Instance();
	}
108214
public function registerType($typeName, $className)
    {
        if (isset($this->bindings[$typeName])) {
            throw new \InvalidArgumentException("`$typeName` is already registerd.");
        }

        $type = new \ReflectionClass($typeName);
        $class = new \ReflectionClass($className);
        $this->bindings[$typeName] = new Service($type, $class);

        return $this;
    }
291787
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        $intersection_types = $this->getNamespacedIntersectionTypes(
            $namespace,
            $aliased_classes,
            $this_class,
            $use_phpdoc_format
        );

        if ($this->value === 'static') {
            return 'static';
        }

        if ($this->value === $this_class) {
            return 'self' . $intersection_types;
        }

        if ($namespace && stripos($this->value, $namespace . '\\') === 0) {
            return preg_replace(
                '/^' . preg_quote($namespace . '\\') . '/i',
                '',
                $this->value
            ) . $intersection_types;
        }

        if (!$namespace && stripos($this->value, '\\') === false) {
            return $this->value . $intersection_types;
        }

        if (isset($aliased_classes[strtolower($this->value)])) {
            return $aliased_classes[strtolower($this->value)] . $intersection_types;
        }

        return '\\' . $this->value . $intersection_types;
    }
595654
public function createDataType($typeName)
    {
        try {
            $cls = "";
            $typelwr = strtolower($typeName);
            foreach ($this->typedefs as $name => $class) {
                if (strtolower($name) === $typelwr) {
                    $cls = StringHelper::unqualify($class);
                    break;
                }
            }

            if ($cls === "") {
                return null;
            }

            if (!class_exists($cls)) {
                throw new BuildException(
                    "Could not instantiate class $cls, even though a class was specified. (Make sure that the specified class file contains a class with the correct name.)"
                );
            }

            $type = new $cls();
            $this->project->log("  +Type: $typeName", Project::MSG_DEBUG);
            if (!($type instanceof DataType)) {
                throw new Exception("$class is not an instance of phing.types.DataType");
            }
            if ($type instanceof ProjectComponent) {
                $type->setProject($this->project);
            }
        } catch (Exception $t) {
            throw new BuildException("Could not create type: $typeName", $t);
        }
        // everything fine return reference
        return $type;
    }
1048736
protected function _getNamespace($className, $pluginPath = null, $prefixPath = null)
    {
        $namespace = preg_replace('/(.*)Controller\//', '', $className);
        $namespace = preg_replace('/\//', '\\', $namespace);
        $namespace = preg_replace('/\.php/', '', $namespace);
        $prefixPath = preg_replace('/\//', '\\', Inflector::camelize($prefixPath));
        if (!$pluginPath) {
            $rootNamespace = Configure::read('App.namespace');
        } else {
            $rootNamespace = preg_replace('/\//', '\\', $pluginPath);
        }
        $namespace = [
            $rootNamespace,
            'Controller',
            $prefixPath,
            $namespace
        ];

        return implode('\\', Hash::filter($namespace));
    }