函数register的别名

@param  $id
@param  $definition
@param  array      $params
@return $this
486783
public function set(string $id, $definition, $params = [])
    {
        return $this->register($id, $definition, $params);
    }
111247
private function completeDefinition($id, Definition $definition)
    {
        if (!$reflectionClass = $this->getReflectionClass($id, $definition)) {
            return;
        }

        if ($this->container->isTrackingResources()) {
            $this->container->addResource(static::createResourceForClass($reflectionClass));
        }

        if (!$constructor = $reflectionClass->getConstructor()) {
            return;
        }

        $arguments = $definition->getArguments();
        foreach ($constructor->getParameters() as $index => $parameter) {
            if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
                continue;
            }

            try {
                if (!$typeHint = $parameter->getClass()) {
                    // no default value? Then fail
                    if (!$parameter->isOptional()) {
                        throw new RuntimeException(sprintf('Unable to autowire argument index %d ($%s) for the service "%s". If this is an object, give it a type-hint. Otherwise, specify this argument\'s value explicitly.', $index, $parameter->name, $id));
                    }

                    if (!array_key_exists($index, $arguments)) {
                        // specifically pass the default value
                        $arguments[$index] = $parameter->getDefaultValue();
                    }

                    continue;
                }

                if (null === $this->types) {
                    $this->populateAvailableTypes();
                }

                if (isset($this->types[$typeHint->name])) {
                    $value = new Reference($this->types[$typeHint->name]);
                } else {
                    try {
                        $value = $this->createAutowiredDefinition($typeHint, $id);
                    } catch (RuntimeException $e) {
                        if ($parameter->allowsNull()) {
                            $value = null;
                        } elseif ($parameter->isDefaultValueAvailable()) {
                            $value = $parameter->getDefaultValue();
                        } else {
                            throw $e;
                        }
                    }
                }
            } catch (\ReflectionException $e) {
                // Typehint against a non-existing class

                if (!$parameter->isDefaultValueAvailable()) {
                    throw new RuntimeException(sprintf('Cannot autowire argument %s for %s because the type-hinted class does not exist (%s).', $index + 1, $definition->getClass(), $e->getMessage()), 0, $e);
                }

                $value = $parameter->getDefaultValue();
            }

            $arguments[$index] = $value;
        }

        // it's possible index 1 was set, then index 0, then 2, etc
        // make sure that we re-order so they're injected as expected
        ksort($arguments);
        $definition->setArguments($arguments);
    }
462013
private function replaceBlockName(ContainerBuilder $container, Definition $definition, $id)
    {
        $arguments = $definition->getArguments();

        // Replace empty block id with service id
        if ($this->serviceDefinitionNeedsFirstArgument($definition)) {
            // NEXT_MAJOR: Remove the if block when Symfony 2.8 support will be dropped.
            if (method_exists($definition, 'setArgument')) {
                $definition->setArgument(0, $id);

                return;
            }

            $definition->replaceArgument(0, $id);

            return;
        }

        if ($id !== $arguments[0] && 0 !== strpos(
            (string) $container->getParameterBag()->resolveValue($definition->getClass()),
            'Sonata\\BlockBundle\\Block\\Service\\'
        )) {
            // NEXT_MAJOR: Remove deprecation notice
            @trigger_error(
                sprintf('Using service id %s different from block id %s is deprecated since 3.3 and will be removed in 4.0.', $id, $arguments[0]),
                E_USER_DEPRECATED
            );
        }
    }
358205
function register(id, name, schema) {
        if (!id || !name || !schema) {
            console.error("register(): missing required parameters: id, name, or schema");
            return;
        }

        if (validate(schema)) {
            _schemaMap[id] = {
                id: id,
                name: name,
                schema: schema
            };

            // Build Preference Item Map
            _.each(schema, function (item, key) {
                if (item) {
                    _itemMap[key] = item;
                }
            });
        }
    }
668817
public function createForTask(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::POST,
            ResourceMethodEnum::CREATE_FOR_TASK,
            $params,
            $id
        );
    }
285104
public function register(string $name, Closure $definition)
    {
        $this->registrar->set($name, $definition);
    }
604874
public function download(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::GET,
            ResourceMethodEnum::DOWNLOAD,
            $params,
            $id
        );
    }
215824
public function setDefinition($id, Definition $definition)
    {
        if ($this->isCompiled()) {
            throw new BadMethodCallException('Adding definition to a compiled container is not allowed');
        }

        $id = (string) $id;

        if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) {
            throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
        }

        unset($this->aliasDefinitions[$id], $this->removedIds[$id]);

        return $this->definitions[$id] = $definition;
    }
71228
public function supports($id, $definition)
    {
        if (is_string($definition) && '@' == substr($definition, 0, 1)) {
            return false;
        }
        return is_scalar($definition) ||
               is_array($definition) ||
               (is_object($definition) && !is_callable($definition));
    }
148783
public function registerItinerary(Definition $definition, $name)
    {
        $id = self::ITINERARY_ID_PREFIX.'v'.$this->currentLoadingVersion.'.'.$name;

        // Avoid name duplicities
        if (in_array($id, $this->registeredNames)) {
            throw new InvalidConfigurationException('Itinerary name used twice: '.$id);
        }
        $this->registeredNames[] = $id;

        $this->container->setDefinition($id, $definition);
        $definition->setProperty('id', $id);
        $definition->setArguments([$name]);

        return new Reference($id);
    }
781894
public function getCreator($id, array $params = array())
    {
        return $this->get($this->getPath().'/'.rawurlencode($id).'/memberCreator', $params);
    }
736612
public function setDefinition($id, \Closure $definition, $tags = [])
    {
        $this->serviceDefinitions[$id] = $definition;
        $this->tags[$id] = $tags;
    }
1356313
private function addService($definition, $id, \DOMElement $parent)
    {
        $service = $this->document->createElement('service');
        if (null !== $id) {
            $service->setAttribute('id', $id);
        }
        if ($class = $definition->getClass()) {
            if ('\\' === substr($class, 0, 1)) {
                $class = substr($class, 1);
            }

            $service->setAttribute('class', $class);
        }
        if (!$definition->isShared()) {
            $service->setAttribute('shared', 'false');
        }
        if (!$definition->isPrivate()) {
            $service->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
        }
        if ($definition->isSynthetic()) {
            $service->setAttribute('synthetic', 'true');
        }
        if ($definition->isLazy()) {
            $service->setAttribute('lazy', 'true');
        }
        if (null !== $decorated = $definition->getDecoratedService()) {
            list($decorated, $renamedId, $priority) = $decorated;
            $service->setAttribute('decorates', $decorated);
            if (null !== $renamedId) {
                $service->setAttribute('decoration-inner-name', $renamedId);
            }
            if (0 !== $priority) {
                $service->setAttribute('decoration-priority', $priority);
            }
        }

        foreach ($definition->getTags() as $name => $tags) {
            foreach ($tags as $attributes) {
                $tag = $this->document->createElement('tag');
                $tag->setAttribute('name', $name);
                foreach ($attributes as $key => $value) {
                    $tag->setAttribute($key, $value);
                }
                $service->appendChild($tag);
            }
        }

        if ($definition->getFile()) {
            $file = $this->document->createElement('file');
            $file->appendChild($this->document->createTextNode($definition->getFile()));
            $service->appendChild($file);
        }

        if ($parameters = $definition->getArguments()) {
            $this->convertParameters($parameters, 'argument', $service);
        }

        if ($parameters = $definition->getProperties()) {
            $this->convertParameters($parameters, 'property', $service, 'name');
        }

        $this->addMethodCalls($definition->getMethodCalls(), $service);

        if ($callable = $definition->getFactory()) {
            $factory = $this->document->createElement('factory');

            if (\is_array($callable) && $callable[0] instanceof Definition) {
                $this->addService($callable[0], null, $factory);
                $factory->setAttribute('method', $callable[1]);
            } elseif (\is_array($callable)) {
                if (null !== $callable[0]) {
                    $factory->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]);
                }
                $factory->setAttribute('method', $callable[1]);
            } else {
                $factory->setAttribute('function', $callable);
            }
            $service->appendChild($factory);
        }

        if ($definition->isDeprecated()) {
            $deprecated = $this->document->createElement('deprecated');
            $deprecated->appendChild($this->document->createTextNode($definition->getDeprecationMessage('%service_id%')));

            $service->appendChild($deprecated);
        }

        if ($definition->isAutowired()) {
            $service->setAttribute('autowire', 'true');
        }

        if ($definition->isAutoconfigured()) {
            $service->setAttribute('autoconfigure', 'true');
        }

        if ($definition->isAbstract()) {
            $service->setAttribute('abstract', 'true');
        }

        if ($callable = $definition->getConfigurator()) {
            $configurator = $this->document->createElement('configurator');

            if (\is_array($callable) && $callable[0] instanceof Definition) {
                $this->addService($callable[0], null, $configurator);
                $configurator->setAttribute('method', $callable[1]);
            } elseif (\is_array($callable)) {
                $configurator->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]);
                $configurator->setAttribute('method', $callable[1]);
            } else {
                $configurator->setAttribute('function', $callable);
            }
            $service->appendChild($configurator);
        }

        $parent->appendChild($service);
    }
161527
public function setId($id)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($id) {
            if ($tab instanceof FormInterface) {
                $tab->setId($id);
            }
        });

        return $this;
    }
95503
protected function registerProviderIfDeferredFor($id): void
    {
        $providers = $this->deferredProviders;
        if ($providers->count() === 0) {
            return;
        }

        foreach ($providers as $provider) {
            if ($provider->hasDefinitionFor($id)) {
                $provider->register();

                // provider should be removed after registration to not be registered again
                $providers->detach($provider);
            }
        }
    }
1198009
public function bind($id, $definition = [], $replace = true)
    {
        $container = Container::$instance;
        if (!$replace && $container->has($id)) {
            throw new InvalidParamException("Can not bind service, service '$id' is already exists.");
        }

        if (is_array($definition) && !isset($definition['class'])) {
            throw new InvalidConfigException("The configuration for the \"$id\" service must contain a \"class\" element.");
        }

        $container->setSingleton($id, $definition);
    }
237018
protected function _register($id, $className)
    {
        $id = (string) $id;
        if (class_exists($className)) {
            self::$_loaded[$id] = $className;
            $this[$id] = function () use ($className) {
                return new $className();
            };
        } else {
            throw new Exception("Helper \"{{$className}}\" not found!");
        }
    }