@param ContainerInterface $container

@return array

@throws ContainerExceptionInterface
@throws NotFoundExceptionInterface
5745
private function getSettings(ContainerInterface $container): array
    {
        $appConfig = null;

        /** @var CacheSettingsProviderInterface $settingsProvider */
        if ($container->has(CacheSettingsProviderInterface::class) === true &&
            ($settingsProvider = $container->get(CacheSettingsProviderInterface::class)) !== null
        ) {
            $appConfig = $settingsProvider->getApplicationConfiguration();
        }

        return [
            $appConfig[A::KEY_IS_DEBUG] ?? false,
            $appConfig[A::KEY_APP_NAME] ?? null,
            $appConfig[A::KEY_EXCEPTION_DUMPER] ?? null,
        ];
    }
673804
static public function run(ContainerInterface $container)
    {
        $request = ServerRequestFactory::fromGlobals();
        $container->set('Request', $request);
        $response = $container->get('HttpDispatcher')->dispatch($request);

        if (is_null($response)) {
            $controller = new Controller($container);
            $response = new TextResponse('Internal server error. Dispatcher returned null response.', 500);
        }

        (new SapiEmitter())->emit($response);
    }
147525
public function process(ContainerBuilder $container)
    {
        $repository = $container->getDefinition(HandlerRepository::class);
        $finder = new BundleNameFinder($container->getParameter('kernel.bundles'));

        $locatableServices = [];

        foreach ($container->findTaggedServiceIds(self::HANDLER_TAG) as $id => $attributes) {
            $repository->addMethodCall('addBundleName', [
                $id,
                $finder->find($container->getDefinition($id)->getClass()),
            ]);

            $locatableServices[$id] = new Reference($id);
        }

        $repository->replaceArgument(0, ServiceLocatorTagPass::register($container, $locatableServices));
    }
249944
protected function mapDefaultContainerParams(ContainerInterface $container): ContainerInterface
    {
        /** @var \SprykerEco\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $container */
        $container->setMid($this->standardParameters->getMid());
        $container->setAid($this->standardParameters->getAid());
        $container->setPortalid($this->standardParameters->getPortalId());
        $container->setKey(md5($this->standardParameters->getKey()));
        $container->setMode($this->modeDetector->getMode());
        $container->setIntegratorName(PayoneApiConstants::INTEGRATOR_NAME_SPRYKER);
        $container->setIntegratorVersion(PayoneApiConstants::INTEGRATOR_VERSION_3_0_0);
        $container->setSolutionName(PayoneApiConstants::SOLUTION_NAME_SPRYKER);
        $container->setSolutionVersion(PayoneApiConstants::SOLUTION_VERSION_3_0_0);

        return $container;
    }
213449
private function resolveParameters(string $id, array $parameters, ContainerInterface $container): array
    {
        $resolved = [];
        foreach ($parameters as $parameter) {
            $resolved[] = $this->getParameterValue($id, $parameter, $container);
        }
        return $resolved;
    }
1251746
public function setContainer(ContainerInterface $container = null)
    {
        $this->abortIf(is_null($container), 'Requires DI container');

        $this->fs = $container->get('filesystem');
        $this->em = $container->get('doctrine.orm.entity_manager');
        $this->target = $container->getParameter('kernel.root_dir').'/../web/media/example/';
        $this->source = $container->get('kernel')->locateResource('@AnimeDbDevBundle/Resource/private/images/');
    }
1085173
public static function buildFromContainer(ContainerInterface $container): App
    {
        return new App(
            self::request($container),
            self::response($container),
            self::processor($container),
            self::matchableRequest($container),
            self::errorHandler($container),
            self::invalidRequestHandler($container),
            self::streamReadLength($container)
        );
    }
1316275
private function getMigrations(ContainerInterface $container): Generator
    {
        $connection = $this->getConnection($container);
        $manager    = $connection->getSchemaManager();

        if ($manager->tablesExist([static::MIGRATIONS_TABLE]) === true) {
            $migrated = $this->readMigrated($connection);
        } else {
            $this->createMigrationsTable($manager);
            $migrated = [];
        }

        $notYetMigrated = array_diff($this->getMigrationClasses(), $migrated);

        foreach ($notYetMigrated as $class) {
            yield $class;
            $this->saveMigration($connection, $class);
        }
    }
941229
protected static function getHostUri(ContainerInterface $container): string
    {
        /** @var RequestStorageInterface $curRequestStorage */
        $curRequestStorage = $container->get(RequestStorageInterface::class);
        $curRequestUri     = $curRequestStorage->get()->getUri();

        $scheme = $curRequestUri->getScheme();
        $host   = $curRequestUri->getHost();
        $port   = $curRequestUri->getPort();

        $result = $port === null || $port === 80 ? "$scheme://$host" : "$scheme://$host:$port";

        return $result;
    }
482198
protected function buildConfiguration(ContainerInterface $container)
	{
		$config = array();

		$processor = new Processor();

		$configurationOverride = $this->getConfigurationOverrides();

		foreach ($this->configurationSections as $key => $definition) {
			$package = $definition['package'];
			$data = $definition['data'];

			$configuration = $package->getConfiguration();

			$configs = array();

			$configs[] = $data;

			if (array_key_exists($key, $configurationOverride)) {
				$configs[] = $configurationOverride[$key];
				unset($configurationOverride[$key]);
			}
			
			$packageConfiguration = $processor->processConfiguration($configuration, $configs);

			foreach ($packageConfiguration as $confKey => $value) {
				$config[$key.'.'.$confKey] = $value;
			}
		}

		if (count($configurationOverride) != 0) {
			throw new \LogicException(
				sprintf('Extra keys are found in Supra\'s config.yml that do not belong to any package: %s.',
					implode(', ', array_keys($configurationOverride)))
			);
		}

		array_walk_recursive($config, function (&$value) use (&$config) {
			if (!is_string($value)) {
				return;
			}

			$count = preg_match_all('/%[a-z\\._]+%/i', $value, $matches);

			if (!$count) {
				return;
			}

			$replacements = array();

			foreach ($matches as $expression) {
				$parameter = trim($expression[0], '%');
				$chunks = explode('.', $parameter);

				$name = $chunks[0].'.'.$chunks[1];

				if (!isset($config[$name])) {
					throw new ReferenceException(sprintf('Parameter "%s" can not be resolved', $name));
				}

				$val = $config[$name];

				if (count($chunks) > 2) {
					$path = array_slice($chunks, 2);

					while ($key = array_shift($path)) {
						if (!array_key_exists($key, $val)) {
							throw new ReferenceException(sprintf('Lost at sub-key "%s" for parameter "%s"', $key, $parameter));
						}

						$val = $val[$key];
					}
				}

				$replacements[$expression[0]] = $val;
			}

			$value = strtr($value, $replacements);
		});

		foreach ($config as $key => $value) {
			$container->setParameter($key, $value);
		}

		//create services defined by 'services:' section
		foreach ($this->configurationSections as $key => $definition) {
			if (isset($config[$key.'.services'])) {
				foreach ($config[$key.'.services'] as $id => $serviceDefinition) {
					$container[$id] = function ($container) use ($serviceDefinition) {
						//this is where the magic happens
						$className = $serviceDefinition['class'];
						$parameters = $serviceDefinition['parameters'];

						$reflection = new \ReflectionClass($className);

						foreach ($parameters as $key => $parameter) {
							if (is_string($parameter) && isset($parameter[0]) && $parameter[0] == '@') {
								$parameters[$key] = $container[ltrim($parameter, '@')];
							}
						}

						$instance = $reflection->newInstanceArgs($parameters);

						return $instance;
					};
				}
			}
		}
	}
776884
public static function createObserver(
        ContainerInterface $container
    ): ObserverInterface {
        /**
         * @var Observer
         */
        $observer = new Observer($container->get(ObservedFactoryInterface::class));
        $observer->addEventDispatcher($container->get(EventDispatcherBridgeInterface::class));
        $observer->setTokenizer($container->get(TokenizerInterface::class));

        return $observer;
    }
587039
public static function getContainer() : ?ContainerInterface
    {
        if (is_null(self::$container)) {
            self::setContainer(self::getDefaultContainer());
        }

        return self::$container;
    }
465879
public function cachedContainer(): ContainerInterface
    {
        /**
         * @noinspection   PhpIncludeInspection Include generated file
         * @psalm-suppress UnresolvableInclude Include generated file
         */
        include_once $this->getContainerClassPath();

        /** @psalm-var class-string<\Symfony\Component\DependencyInjection\Container> $containerClassName */
        $containerClassName = $this->getContainerClassName();

        /** @var ContainerInterface $container */
        $container = new $containerClassName();

        return $container;
    }
1329849
public function getContainerTypes($container)
    {
        if (isset($this->types[$container])) {
            return $this->types[$container];
        }

        return $this->defaultTypes;
    }
848346
protected function injectPackages(ContainerInterface $container)
	{
		foreach ($this->getPackages() as $package) {
			$package->inject($container);
		}
	}
211416
protected function doBuildWhere(ContainerInterface $container)
    {
        $condition = '';
        if ($container->getCondition()) {
            $condition .= $this->buildCondition($container);
        } else {
            foreach ($container->getCollectionOfConditions() as $subContainer) {
                if (ContainerInterface::CONDITION_NAME === $subContainer->getType()) {
                    $condition .= $this->buildCondition($subContainer);
                } elseif (ContainerInterface::COLLECTION_NAME === $subContainer->getType()) {
                    $condition .= $this->doBuildWhere($subContainer);
                }
            }
        }
        if (!$condition = $this->trimAndOr($condition)) {
            return null;
        }

        return sprintf(
            '%s(%s)',
            $container->getAndOr() ? sprintf(' %s ', $container->getAndOr()) : null,
            $condition
        );
    }
469064
protected function getSeeds(ContainerInterface $container): Generator
    {
        $connection = $this->getConnection($container);
        $manager    = $connection->getSchemaManager();

        if ($manager->tablesExist([$this->getSeedsTable()]) === true) {
            $seeded = $this->readSeeded($connection);
        } else {
            $this->createSeedsTable($manager);
            $seeded = [];
        }

        $notYetSeeded = array_diff($this->getSeedClasses(), $seeded);

        foreach ($notYetSeeded as $class) {
            yield $class;
            $this->saveSeed($connection, $class);
        }
    }