Get the container.

@return ContainerInterface
515492
protected function initContainer()
    {
        $container = $this->loadContainer(Configuration::projectDir() . $this->config['container']);

        if (!$container instanceof ContainerInterface) {
            throw new \UnexpectedValueException("Failed to get a container from '{$this->config['container']}'");
        }

        return $container;
    }
83705
protected function initialiseContainer()
    {
        // @todo: add some form of container caching?
        $container = $this->buildContainer();
        $this->prepareContainer($container);

        $this->container = $container;
        return $this->container;
    }
125282
public function getContainer(){
        if(null === $this->container){
            $factory    = (new ContainerFactory())
                ->append(\Fratily\Kernel\Container\KernelContainer::class)
            ;

            foreach($this->bundles as $bundle){
                if($bundle instanceof Bundle\ContainerRegisterInterface){
                    $bundle->containerRegister($factory);
                }
            }

            $this->container    = $factory->create([
                "kernel"    => $this,
            ]);
        }

        return $this->container;
    }
140194
protected static function createContainer()
    {
        $app = JFactory::getApplication();

        if (is_null($app->get('container', null))) {
            $app->set('container', new Container());
        }

        $container = $app->get('container');

        if (!method_exists($container, 'set')) {
            $container = new Container($container);
        }

        return $container;
    }
996280
public function getService()
    {
        $service = $this->getOption('service');

        return \Owl\Service\Container::getInstance()->get($service);
    }
404185
public function getContainer()
    {
        if (null !== $this->container) {
            throw new ContainerAlreadyExistsException($this->container);
        }

        // Construct container
        $this->container = new Container();
        $this->hydrateContainerWithBootstrapParameters();

        if (false === $this->tryParseContainerDump()) {
            $this->hydrateContainerWithApplicationParameters();
            $this->loadApplicationServices();
        }

        return $this->container;
    }
607286
public function getContainerBuilder() {
    if (!isset($this->containerBuilder)) {
      // Get the kernel, and hack it to get a compiled container.
      // We need this rather than the normal cached container, as that doesn't
      // allow us to get the full service definitions.
      $kernel = \Drupal::service('kernel');
      $kernel_R = new \ReflectionClass($kernel);

      $compileContainer_R = $kernel_R->getMethod('compileContainer');
      $compileContainer_R->setAccessible(TRUE);

      $this->containerBuilder = $compileContainer_R->invoke($kernel);
    }

    return $this->containerBuilder;
  }
815355
public function getContainer()
    {
        $mutex = new Mutex($this->file . '.lock', true);

        $ret = $mutex->run(
            function () {
                if ($this->needsRecompile()) {
                    file_put_contents($this->file, $this->compileContainerCode());
                }
                return include $this->file;
            }
        );

        if (!($ret instanceof Container)) {
            throw new \LogicException("The container must be returned by the compiler");
        }
        foreach ($this->plugins as $plugin) {
            $ret->addPlugin($plugin);
        }
        return $ret;
    }
293422
public function getControl()
	{
		$container = clone $this->container;
		parent::getControl();
		$control = Html::el("div", array("style" => "text-align:justify"));
		$control->setHtml($this->translate((string)$this->getValue()));
		$container->add($control);

		return $container;
	}
476662
public function build() : ContainerInterface
    {
        try{
            $cache_dir = new File($this->compiler_config->getCacheDir());
        
            if (!$cache_dir->exists()){
                throw new CacheDirectoryNotFoundException($cache_dir);
            }
    
            $cache_filename = $this->compiler_config->getCacheFilename();
            $bootstrap_file = new File($cache_filename . '.php', $cache_dir);
        
            if (!$bootstrap_file->exists()){
                $this->compiler->compile($this->compiler_config);
            }
        
            if (!$bootstrap_file->exists()){
                throw new BootstrapFileNotFoundException($bootstrap_file);
            }
        
            //$startup = eval($bootstrap_file->getContents());
            /** @noinspection PhpIncludeInspection */
            $startup = require($bootstrap_file);
        
            $startup($this->container);
        }
        catch(\Throwable $e)
        {
            throw new ContainerBuildingException($e);
        }
        return $this->container;
    }
791370
protected function getContainer()
	{
		static $container;

		if ( !isset($container) ) {
			/** @var ContainerHelper $container_helper */
			$container_helper = $this->getHelper('container');

			$container = $container_helper->getContainer();
		}

		return $container;
	}
1221296
public function getScope()
    {
        return $this->request->getParam(
            'store'
        ) ? ContainerScopeInterface::SCOPE_STORE_CONTAINERS : ($this->request->getParam(
            'container'
        ) ? ContainerScopeInterface::SCOPE_CONTAINERS : ContainerScopeInterface::SCOPE_DEFAULT);
    }
1262339
public function getContainer()
    {
        if (property_exists(__CLASS__, 'container')) {
            return $this->container;
        } else {
            return parent::getContainer();
        }

        throw new RuntimeException(sprintf('The service container must be accessible from class %s to use this trait', __CLASS__));
    }
447940
protected function getContainer()
    {
        @trigger_error(sprintf('The "%s()" method is deprecated and will be removed in DoctrineBundle 2.0.', __METHOD__), E_USER_DEPRECATED);

        if ($this->container === null) {
            $application = $this->getApplication();
            if ($application === null) {
                throw new LogicException('The container cannot be retrieved as the application instance is not yet set.');
            }

            $this->container = $application->getKernel()->getContainer();
        }

        return $this->container;
    }
1111700
public static function get(ContainerInterface $container) {
    $use_ecomm_sessions = $container
      ->get('config.factory')
      ->get('acm.commerce_users')
      ->get('use_ecomm_sessions');

    if ($use_ecomm_sessions) {
      return $container->get('acm.external_commerce_account_proxy');
    }

    return $container->get('acm.commerce_account_proxy');
  }
109410
protected static function ctxGetContainer(ContextInterface $context): ContainerInterface
    {
        assert(static::ctxHasContainer($context));

        return $context->get(ContextProperties::CTX_CONTAINER);
    }
372530
public function getContainer()
    {
        if (is_null($this->_container)) {
            $def = [
                "db_{$this->configName}" => Definition::factory(
                        function() {
                            $args = Configuration::get($this->_configFile)
                                ->get($this->_configName);
                            $adapter = new Adapter($args);
                            return $adapter->initialize();
                        }
                    ),
                'sharedEventManager' => Definition::object(
                        'Zend\EventManager\SharedEventManager'
                    )
            ];
            $this->setContainer(ContainerBuilder::buildContainer($def));
        }
        return $this->_container;
    }