This method is responsible for initializing the Environment. Called by Container.

@param Container $container

@return Environment
544879
public function setupEnvironment(Container $container)
    {
        $env = new Environment(
            $container->get('Minty\\AbstractTemplateLoader'),
            $this->getConfiguration('options')
        );

        /** @var $request \Miny\HTTP\Request */
        $request = $container->get('Miny\\HTTP\\Request');

        $env->addGlobalVariable('is_ajax', $request->isAjax());
        $env->addGlobalVariable('is_internal_request', $request->isSubRequest());

        $env->addExtension(new Core());
        $env->addExtension(new Optimizer());
        $env->addExtension($container->get(__NAMESPACE__ . '\\Extensions\\Miny'));

        if ($env->getOption('debug')) {
            $env->addExtension(new Debug());

            if ($this->getConfiguration('enable_node_tree_visualizer')) {
                $env->addExtension($container->get(__NAMESPACE__ . '\\Extensions\\Visualizer'));
            }
        }

        return $env;
    }
1331535
public function provideBusinessLayerDependencies(Container $container): Container
    {
        parent::provideBusinessLayerDependencies($container);

        $container = $this->addProductListPostSaverPlugins($container);
        $container = $this->addProductListPreDeleterPlugins($container);
        $container = $this->addProductListTransferExpanderPlugins($container);

        return $container;
    }
58832
public function authorisation(Container $container)
    {
        $auth   = new Authorisation();
        $config = $container->get('config');

        foreach ((array) $config->get('user.policies') as $name => $policy) {
            if ($policy instanceof ClassMeta || (is_string($policy) && class_exists($policy))) {
                $instance = $container->newInstance($policy);

                if (is_subclass_of($instance, PolicyInterface::class)) {
                    $auth->addPolicy($name, $instance);
                } elseif (is_subclass_of($instance, PolicyProviderInterface::class)) {
                    $auth->registerPolicyProvider($instance);
                }
            } elseif ($policy === false) {
                continue;
            } else {
                throw new \InvalidArgumentException(sprintf(
                    'Please register instance of %s or %s',
                    PolicyInterface::class,
                    PolicyProviderInterface::class
                ));
            }
        }

        /** @var EventDispatcher $dispatcher */
        $this->dispatcher->triggerEvent('onLoadAuthorisationPolicies', ['auth' => $auth]);

        return $auth;
    }
1302922
public function container($container = null, Closure $callback = null)
    {
        $container = is_null($container) ? $this->defaultContainer : $container;

        if (!isset($this->containers[$container])) {
            $this->addContainer(
                $container,
                $this->getContainerTypes($container),
                $this->getContainerFormat($container),
                $this->getContainerFormats($container)
            );
        }

        if (is_callable($callback)) {
            $callback($this->containers[$container]);
        }

        return $this->containers[$container];
    }
1027219
protected function setDependencies(Container $container)
    {
        $this->setTranslator($container['translator']);
        $this->setView($container['view']);
        $this->setTemplateFactory($container['template/factory']);
        if (isset($container['config']['handlers.defaults'])) {
            $this->setConfig($container['config']['handlers.defaults']);
        }
        return $this;
    }
106262
protected function newCommandInBackground(Container $container)
    {
        (new Process($this->buildBackgroundCommand(), base_path(), null, null, null))->run();
    }
71584
public function boot(Container $container)
    {
        $config = $container->get('config');

        if (!$config->get('system.debug')) {
            return;
        }

        $error = $container->get('error.handler');

        /**
         * @param \Exception|\Throwable $e
         *
         * @return  void
         */
        $handler = function ($e) use ($container) {
            /** @var Whoops $whoops */
            $whoops = $container->get('whoops');
            $whoops->allowQuit(false);
            $whoops->handleException($e);
        };

        $error->addHandler($handler, 'default');
    }
877495
protected function initializeContainer()
    {
        $this->container = new ContainerBuilder();

        $this->container->addCompilerPass(new DependencyInjection\EnvironmentCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\TypeCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\ThemeCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\FormatCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\RendererCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\InspectorCompilerPass());
        $this->container->addCompilerPass(new DependencyInjection\MetadataCompilerPass());

        $this->container->setParameter('root_dir', __DIR__);
        $this->container->setParameter('helpers', array(
            'Ladybug\Dumper:dump'
        ));
    }
560420
protected function prepareContainer(Container $container)
    {
        foreach ($this->getKernelParameters() as $key => $value) {
            $container[$key] = $value;
        }

        $container->set('kernel', $this);
        $container->set('configuration', $this->configuration);
        $container->set('request', $this->request);
        $container->set('request_stack', $this->requestStack);
        $container->set('session', $this->session);
    }
262321
public function register(Container $container)
    {
        // Get cache factory object.
        $container->prepareSharedObject(CacheManager::class);

        // Get global cache object.
        $container->share(Cache::class, function (Container $container) {
            /** @var Structure $config */
            $config = $container->get('config');

            $storage = $config->get('cache.storage', 'file');
            $handler = $config->get('cache.serializer', 'php');

            return $container->get(CacheManager::class)->create('windwalker', $storage, $handler);
        });
    }
563114
protected function setupContainer(Container $container=null)
    {
        $this->container = $container ?? $this->container ?? new Container;

        $prefix= $this->getAbstractPrefix();

        if (! $this->container->bound( $prefix.'config')) {
            $this->container->instance( $prefix .'config', new Repository);
        }

        $this->config=$this->container->make( $prefix . 'config');
    }
114923
public function run(Container $container)
    {
        if ($this->description && $this->withoutOverlapping && ! $this->mutex->create($this)) {
            return;
        }

        register_shutdown_function(function ()
        {
            $this->removeMutex();
        });

        parent::callBeforeCallbacks($container);

        try {
            $response = $container->call($this->callback, $this->parameters);
        }
        finally {
            $this->removeMutex();

            parent::callAfterCallbacks($container);
        }

        return $response;
    }
901759
public function containersStart($container = NULL) {
    $this->validateConfig();
    $this->title('Starting containers');
    $command = $this->taskDockerComposeUp();

    if ($container) {
      $this->limitComposeContainer($command, $container);
    }

    $command->file($this->dockerComposeFile)
      ->projectName($this->config->get('name'))
      ->detachedMode()
      ->run();
  }
1192067
public function handle(Container $container)
    {
        $class = new \ReflectionClass(get_class($this->methodInvocation->getThis()));
        if ($class->getFileName()) {
            $method = $this->methodInvocation->getMethod()->getName();
            $container->call(
                [
                    $this->methodInvocation->getThis(),
                    $method,
                ],
                $this->methodInvocation->getArguments()->getArrayCopy()
            );
        }
    }
92499
protected function addCompanyFacade(Container $container): Container
    {
        $container[static::FACADE_COMPANY] = function (Container $container) {
            return new CompaniesRestApiToCompanyFacadeBridge(
                $container->getLocator()->company()->facade()
            );
        };

        return $container;
    }
1138830
public function setContainer(Symfony\Component\DependencyInjection\Container $container) {
        $this->container = $container;

        return $this;
    }
374362
public function boot( Container $container ) {
		add_action( 'admin_init', [ $this->proxy( $container, 'options_page' ), 'admin_init' ] );
		add_action( 'admin_menu', [ $this->proxy( $container, 'options_page' ), 'admin_menu' ] );
		add_action(
			'admin_notices',
			[ $this->proxy( $container, 'options_page' ), 'print_notice_when_no_notifiers_active' ]
		);
		add_action(
			'admin_init',
			[ $this->proxy( $container, 'options_manager' ), 'register_settings' ]
		);
		add_action( 'soter_run_check', [ $this->proxy( $container, 'check_site_job' ), 'run' ] );
		add_action(
			'soter_site_check_complete',
			[ $this->proxy( $container, 'notifier_manager' ), 'notify' ]
		);

		$this->boot_upgrader( $container );
	}