Registers the given container.

@param container
@throws java.lang.RuntimeException if a container with the same ID had been registered before.
514397
synchronized void add(final Container container) {
    final String containerId = container.getId().toString();
    if (this.hasContainer(containerId)) {
      throw new RuntimeException("Trying to add a Container that is already known: " + containerId);
    }
    this.containers.put(containerId, container);
  }
143042
public static void setOriginContainer(final Set<Tag> tags, final EntityContainer container) {
	final UUID id = Identifiable.getID(container);
	if (id != null) {
	    tags.add(new OriginContainer(id));
	}
    }
887154
public function process(ContainerBuilder $container): void
    {
        $collector = $container->findDefinition('fivelab.resource.serializer.context_collector');
        $services = $container->findTaggedServiceIds('resource.serializer.collector');

        foreach ($services as $serviceId => $tags) {
            try {
                $collectorDefinition = $container->getDefinition($serviceId);
                $collectorClass = $container->getParameterBag()->resolveValue($collectorDefinition->getClass());

                if (!is_a($collectorClass, SerializationContextCollectorInterface::class, true)) {
                    throw new \RuntimeException(sprintf(
                        'The serialization context collector should implement "%s".',
                        SerializationContextCollectorInterface::class
                    ));
                }

                $collector->addMethodCall('add', [
                    new Reference($serviceId),
                ]);
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf(
                    'Can\'t compile resource serialization collector with service id "%s".',
                    $serviceId
                ), 0, $e);
            }
        }
    }
55959
private function registerStandaloneObjects(ContainerBuilder $container)
    {
        //====================================================================//
        // Load Service Definition
        $definition = $container->getDefinition('splash.connectors.standalone');
        //====================================================================//
        // Load List of Tagged Objects Services
        $taggedObjects = $container->findTaggedServiceIds('splash.standalone.object');
        //====================================================================//
        // Register Objects Services
        foreach ($taggedObjects as $id => $serviceTags) {
            foreach ($serviceTags as $attributes) {
                //====================================================================//
                // Ensure Object Type is set
                if (!isset($attributes["type"])) {
                    throw new Exception('Tagged Standalone Object Service as no "type" attribute.');
                }
                //====================================================================//
                // Add Object Service to Connector
                $definition->addMethodCall('registerObjectService', array($attributes["type"], new Reference($id)));
            }
        }
    }
646822
public function register(Container $container, $alias = null)
    {
        $container->set('Repository', [$this, 'createRepositoryFactory'], true, true);

        if (!empty($alias)) {
            $container->alias($alias, 'Repository');
        }
    }
498174
@Override
    public void registerService(ServiceInstance<T> service) throws Exception
    {
        Entry<T> newEntry = new Entry<T>(service);
        Entry<T> oldEntry = services.putIfAbsent(service.getId(), newEntry);
        Entry<T> useEntry = (oldEntry != null) ? oldEntry : newEntry;
        synchronized(useEntry)
        {
            if ( useEntry == newEntry ) // i.e. is new
            {
                useEntry.cache = makeNodeCache(service);
            }
            internalRegisterService(service);
        }
    }
437076
protected function registerResources(ContainerBuilder $container)
    {
        $templatingEngines = $container->getParameter('templating.engines');

        if (in_array('twig', $templatingEngines)) {
            $container->setParameter('twig.form.resources', array_merge(
                array('FenrizbesColorPickerTypeBundle:Form:fields.html.twig'),
                $container->getParameter('twig.form.resources')
            ));
        }
    }
655002
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->collectionServiceId)) {
            return;
        }

        $collection = $this->getCollection($container);

        foreach ($container->findTaggedServiceIds($this->serviceTag) as $id => $attributes) {
            $this->addServiceToCollection($collection, $id);
        }
    }
941907
public function register(Container $container)
    {
        $this->container = $container;

        // Register the PHP view loader if configuration says so
        if (strtolower($container["config.service"]["view.loader"]) === "php") {
            $container->register(new PHPLoaderProvider);
        }

        // Define view class loader
        $container["loadView.service"] = $container->protect(
            function (string $view, bool $useLayout = true) use ($container) {
                $cacheName = "loadView.service-{$view}" . ($useLayout ? "1" : "0");
                if (isset($container[$cacheName]) && isset($container["view.skipCache"]) === false) {
                    return $container[$cacheName];
                }

                $class = $container["view.className"] ?? $this->getViewClass($view);
                $view = new $class(
                    $container["config.service"],
                    $container["tplLoader.service"],
                    $container["response.service"]
                );

                if (method_exists($view, "init")) {
                    $args = func_get_args();
                    $args = array_slice($args, 2);
                    $view->init(...$args);
                }

                if ($useLayout && ($layoutName = $container["config.service"]["view.defaultLayout"]) !== "") {
                    $this->setLayout($layoutName, $view);
                }

                return $container[$cacheName] = $view;
            }
        );

        $container["loadTemplate.service"] = $container->protect(
            function (string $template, bool $useLayout = true) use ($container) {
                $cacheName = "loadTemplate.service-{$template}" . ($useLayout ? "1" : "0");
                if (isset($container[$cacheName])) {
                    return $container[$cacheName];
                }

                $container["view.skipCache"] = true;
                $container["view.className"] = \SlaxWeb\View\Base::class;
                $view = $container["loadView.service"]("", false);
                $view->template = $template;
                unset($container["view.skipCache"], $container["view.className"]);

                if ($useLayout && ($layoutName = $container["config.service"]["view.defaultLayout"]) !== "") {
                    $this->setLayout($layoutName, $view);
                }

                return $container[$cacheName] = $view;
            }
        );
    }
1163966
public void add(Container container, boolean addRelationships) {
        if (container != null && !container.equals(getContainer())) {
            addElement(container, addRelationships);
        }
    }
761843
public function register(Container $container)
    {
        $container->share(MatcherInterface::class, [$this, 'matcher']);

        $container->prepareSharedObject(RouteCreator::class);
        $container->prepareSharedObject(MainRouter::class);
    }
140012
public function register(Container $container)
    {
        $container->prepareSharedObject(RendererManager::class, [$this, 'manager']);
        $container->prepareSharedObject(PackageFinder::class);
        $container->share(WidgetManager::class, [$this, 'widget']);
    }
484427
public function register(Container $container)
    {
        $closure = function (Container $container) {
            $manager = $container->newInstance(LoggerManager::class, [
                'logPath' => $container->get('config')->get('path.logs')
            ]);

            return $manager;
        };

        $container->share(LoggerManager::class, $closure);
    }
885116
public function register( Container $container ) {
		$this->container = $container;

		$container->define(
			array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ),
			$register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) )
		);

		$this->add_assets( $register );
	}
415323
public function register(Container $container)
    {
        $container->prepareSharedObject(DatabaseService::class);

        $closure = function (Container $container) {
            $service = $container->get(DatabaseService::class);

            return $service->createConnection();
        };

        class_alias(AbstractDatabaseDriver::class, DatabaseAdapter::class);
        $container->share(AbstractDatabaseDriver::class, $closure)
            ->alias(DatabaseAdapter::class, AbstractDatabaseDriver::class);

        DatabaseContainer::setDb(function () use ($container) {
            return $container->get(AbstractDatabaseDriver::class);
        });

        // For Exporter
        $closure = function (Container $container) {
            $service = $container->get(DatabaseService::class);

            return $service->getExporter();
        };

        $container->share(AbstractExporter::class, $closure);
    }
531612
public function register(Container $container)
    {
        $closure = function (Container $container) {
            $tz = $container->get('config')->get('system.timezone', 'UTC');

            return new Chronos('now', new \DateTimeZone($tz));
        };

        $container->set(Chronos::class, $closure);
    }
793634
public function register( Container $container ) {
		$this->container = $container;

		$this->container->define( array( 'router' => 'Intraxia\Jaxion\Http\Router' ), $router = new Router );

		$this->add_routes( $router );
	}