Registers the type to use dynamic binding.

@param string $typeName The fully qualified class name.
@return DependencyResolver
556968
public function registerDynamicType($typeName)
    {
        if (isset($this->bindings[$typeName])) {
            throw new \InvalidArgumentException("`$typeName` is already registerd.");
        }

        $type = new \ReflectionClass($typeName);
        $this->bindings[$typeName] = new DynamicService($type);

        return $this;
    }
794183
public static function get_type_by_typename($typename) {
        global $DB;
        $cache = cache::make('core', 'repositories');
        if (($repositorytype = $cache->get('typename:'. $typename)) === false) {
            $repositorytype = null;
            if ($record = $DB->get_record('repository', array('type' => $typename))) {
                $repositorytype = new repository_type($record->type, (array)get_config($record->type), $record->visible, $record->sortorder);
                $cache->set('typeid:'. $record->id, $repositorytype);
            }
            $cache->set('typename:'. $typename, $repositorytype);
        }
        return $repositorytype;
    }
757816
public static function isTypeName(string $typeName): bool
	{
		$matches = [];
		$result = preg_match('~^\\\\?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$~', $typeName, $matches);
		if ($result === false) {
			// @codeCoverageIgnoreStart
			throw new Exception('PREG error ' . preg_last_error());

			// @codeCoverageIgnoreEnd
		}

		return $result !== 0 && $matches !== null;
	}
1024496
public static function registerType($name, $class, $phpTypeName)
    {
        if (isset(static::$typesMap[$name])) {
            throw new BadArgumentException('Cannot register new type with name ":name" because it already registered', [
                'name' => $name,
            ]);
        }
        
        static::overrideType($name, $class, $phpTypeName);
    }
745789
public function getTypeMapping($indexName, $typeName)
    {
        $index = $this->getIndex($indexName);
        $type = $index->getType($typeName);

        return $type->getMapping();
    }
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;
    }
826473
protected function typeToClassName($typeName)
    {
        $classBase = Type::studlyCaps($typeName).'Type';

        $class = __NAMESPACE__."\\$classBase";

        if (class_exists($class)) {
            return $class;
        }

        $class = __NAMESPACE__."\UnitTypes\\$classBase";

        if (class_exists($class)) {
            return $class;
        }

        throw new ResourceNotFoundException("XType class for $typeName not found");
    }
15250
public function add($columnName, FilterTypeInterface $type = null, $filterName = null, array $options = array())
    {
        $this->filterDefinitions[$columnName] = array(
            'type' => $type,
            'options' => $options,
            'filtername' => $filterName,
        );

        return $this;
    }
740521
protected function invokeBindingInitializers($typeName, $object, $initializers = NULL)
	{
		foreach((array)$initializers as $initializer)
		{
			if(is_array($initializer))
			{
				$ref = new \ReflectionMethod(is_object($initializer[0]) ? get_class($initializer[0]) : $initializer[0], $initializer[1]);
			}
			else
			{
				$ref = new \ReflectionFunction($initializer);
			}
	
			$args = $this->populateArguments($ref, 1, [], new InjectionPoint($typeName, $ref->name));
				
			switch(count($args))
			{
				case 0:
					$object = $initializer($object) ?: $object;
					break;
				case 1:
					$object = $initializer($object, $args[0]) ?: $object;
					break;
				case 2:
					$object = $initializer($object, $args[0], $args[1]) ?: $object;
					break;
				case 3:
					$object = $initializer($object, $args[0], $args[1], $args[2]) ?: $object;
					break;
				case 4:
					$object = $initializer($object, $args[0], $args[1], $args[2], $args[3]) ?: $object;
					break;
				default:
					$object = call_user_func_array($initializer, array_merge([$object], $args)) ?: $object;
			}
		}
		
		return $object;
	}
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;
    }
925398
public function addResolver($className, ResolverInterface $resolver)
    {
        if (! class_exists($className)) {
            throw new InvalidArgumentException(
                "The cass '{$className} was not found."
            );
        }

        $this->_definitionResolvers[$className] = $resolver;
        return $this;
    }
891093
public function getDependencyInstance($dependencyName){
        if(isset($this->dependencies[$dependencyName])){
            return $this->loadDependency($dependencyName, $this->dependencies[$dependencyName]);
        }
        return null;
    }
946811
public function registerPlugin($plugin)
    {
        if ($plugin instanceof IOrmPlugin) {
            $this->plugins[] = $plugin;
        } elseif (is_string($plugin) && $this->iocContainer) {
            $this->plugins[] = $this->iocContainer->get($plugin);
        } else {
            throw InvalidArgumentException::format(
                'Invalid plugin supplied to %s: ioc container must be available to resolve class',
                __METHOD__
            );
        }
    }
1206932
public function toAlias($typeName)
	{
		$this->options = self::TYPE_ALIAS;
		$this->to = (string)$typeName;
		
		return $this;
	}
1039817
public function getEnabled($typeName)
    {
        if (!$this->contains($typeName)) {
            return null;
        }

        foreach ($this->listByTypeName($typeName) as $typeDescriptor) {
            if ($typeDescriptor->isEnabled()) {
                return $typeDescriptor;
            }
        }

        return null;
    }
585138
public static void register(String typeName, Class<? extends PropertyEditorBase<?>> editorClass) {
        register(typeName, null, editorClass);
    }
5938
public function addDataTypeDefinition($typeName, $typeClass, $classpath = null)
    {
        ComponentHelper::getComponentHelper($this)->addDataTypeDefinition($typeName, $typeClass, $classpath);
    }