@param PsrContainerInterface $container

@return CsrfTokenStorageInterface
173769
private static function createStorage(PsrContainerInterface $container): CsrfTokenStorageInterface
    {
        /** @var SettingsProviderInterface $provider */
        assert($container->has(SettingsProviderInterface::class));
        $provider = $container->get(SettingsProviderInterface::class);
        assert($provider->has(C::class));
        [
            C::TOKEN_STORAGE_KEY_IN_SESSION => $sessionKey,
            C::MAX_TOKENS                   => $maxTokens,
            C::MAX_TOKENS_THRESHOLD         => $maxTokensThreshold,
        ]
            = $provider->get(C::class);

        /** @var SessionInterface $session */
        assert($container->has(SessionInterface::class));
        $session = $container->get(SessionInterface::class);

        $storage = new CsrfTokenStorage($session, $sessionKey, $maxTokens, $maxTokensThreshold);

        return $storage;
    }
1080775
public function setClientStorage(ClientInterface $storage)
    {
        $storage->setServer($this);
        $this->clientStorage = $storage;

        return $this;
    }
305723
public function register(Container $container)
    {
        $app = $container->get('application');

        $container->share(WebApplication::class, $app);

        // Input
        $container->share(Input::class, function (Container $container) use ($app) {
            return PsrInput::create($app->getRequest());
        })->bindShared(PsrInput::class, Input::class);

        // Request
//        $container->share(ServerRequest::class, $app->getRequest())
//            ->alias(ServerRequestInterface::class, ServerRequest::class);

        // Environment
        $container->share(WebEnvironment::class, $app->getEnvironment());
        $container->share(Browser::class, $app->getEnvironment()->getBrowser());
        $container->share(Platform::class, $app->getEnvironment()->getPlatform());

        // Uri
        $container->share(UriData::class, function (Container $container) use ($app) {
            return $app->getServer()->getUriData();
        });
    }
653988
protected function createAuthorizationServer(Container $container, array $config)
    {
        // TODO: Support scopes

        $authorizationServer = $container->make(AuthorizationServer::class);

        $authorizationServer->setSessionStorage($container->make(SessionInterface::class));
        $authorizationServer->setAccessTokenStorage($container->make(AccessTokenInterface::class));
        $authorizationServer->setRefreshTokenStorage($container->make(RefreshTokenInterface::class));
        $authorizationServer->setClientStorage($container->make(ClientInterface::class));
        $authorizationServer->setScopeStorage($container->make(ScopeInterface::class));
        $authorizationServer->setAuthCodeStorage($container->make(AuthCodeInterface::class));

        $this->configureAuthorizationServer($authorizationServer, $config);

        return $authorizationServer;
    }
320006
public static function getUploadFolder(ContainerInterface $container)
    {
        $request = $container->get('request');

        $baseUrl = dirname($request->getBaseUrl());
        $baseUrl = substr($baseUrl, 1);
        if ( ! empty($baseUrl)) {
            $baseUrl .= '/';
        }

        return $baseUrl . $container->getParameter('red_kite_cms.upload_assets_dir');
    }
1105962
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, Extras::class);
    }
1165462
public function fixRowsPositions(Model\ContainerInterface $container)
    {
        $this->sortChildrenByPosition($container, 'rows');

        $rows = $container->getRows();

        $position = 0;
        foreach ($rows as $row) {
            $row->setPosition($position);
            $position++;
        }

        return $this;
    }
309214
public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
        if ($this->container->has('request') && $this->container->hasScope('request') && $this->container->isScopeActive('request')) {
            $this->request = $this->container->get('request');
        }
    }
797197
public function setContainer(ContainerInterface $container)
    {
        $application = $this;
        $container->share(ApplicationInterface::class, $application);
        $container->share(\Interop\Container\ContainerInterface::class, $container);

        $this->container = $container;

        return $this;
    }
323074
public function register( Container $container ) {
		$container['check_site_job'] = function( Container $c ) {
			return new Check_Site_Job( $c['checker'], $c['options_manager'] );
		};

		$container['checker'] = function( Container $c ) {
			$checker = new Checker( new Api_Client( $c['http'] ), new WP_Package_Manager() );

			$checker->add_post_check_callback( function( $vulnerabilities, $response ) {
				do_action( 'soter_package_check_complete', $vulnerabilities, $response );
			} );

			return $checker;
		};

		$container['http'] = function( Container $c ) {
			return new Cached_Http_Client(
				new WP_Http_Client( $c['user_agent'] ),
				new WP_Transient_Cache( $c['prefix'], HOUR_IN_SECONDS )
			);
		};

		$container['notifier_manager'] = function( Container $c ) {
			$options = $c['options_manager'];

			return new Notifier_Manager( $options, [
				new Email_Notifier( $c['plates'], $options ),
				new Slack_Notifier( $options, $c['user_agent'] ),
			] );
		};

		$container['options_manager'] = function( Container $c ) {
			return new Options_Manager( new Options_Store( $c['prefix'] ) );
		};

		$container['options_page'] = function( Container $c ) {
			return new Options_Page( $c['options_manager'], $c['plates'] );
		};

		$container['plates'] = function( Container $c ) {
			$engine = new Engine( $c['dir'] . '/templates' );

			// Drop the file extension so we can also load .css files.
			$engine->setFileExtension( null );
			$engine->loadExtension( new Button_Extension() );
			$engine->addData(
				[
					'plugin_url' => $c['url'],
					'site_name' => get_bloginfo( 'name' ),
					'site_url' => site_url(),
				],
				[
					'emails/html/error.php',
					'emails/html/vulnerable.php',
					'emails/partials/footer.php',
					'emails/partials/header.php',
					'emails/text/error.php',
					'emails/text/vulnerable.php',
				]
			);

			return $engine;
		};

		$container['user_agent'] = function( Container $c ) {
			return sprintf(
				'%s (%s) | %s | v%s | %s',
				get_bloginfo( 'name' ),
				get_home_url(),
				$c['name'],
				$c['version'],
				$c['url']
			);
		};
	}
101327
public static function buildTemplating(ContainerInterface $container)
    {
        $factory = new TwigFactory(
            $container->getParameter('kernel.template_dir'),
            $container->getParameter('kernel.cache_dir'),
            $container->getParameter('kernel.env')
        );

        return($factory->getServiceClass());
    }
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;
    }
525049
protected static function createAuthenticationFailedResponse(ContainerInterface $container): ResponseInterface
    {
        /** @var SettingsProviderInterface $provider */
        $provider = $container->get(SettingsProviderInterface::class);
        $settings = $provider->get(S::class);
        $factory  = $settings[S::KEY_FAILED_CUSTOM_UNAUTHENTICATED_FACTORY] ?? null;

        assert($factory === null || is_callable($factory) === true);

        $response = $factory === null ? new EmptyResponse(401) : call_user_func($factory);

        return $response;
    }
72411
public static function configureContainer(LimoncelloContainerInterface $container): void
    {
        $factory = new Factory($container);

        $container[FactoryInterface::class] = $factory;

        $container[JsonSchemasInterface::class] = function (PsrContainerInterface $container) use ($factory) {
            $settings     = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
            $modelSchemas = $container->get(ModelSchemaInfoInterface::class);

            return $factory->createJsonSchemas(
                $settings[FluteSettings::KEY_MODEL_TO_SCHEMA_MAP],
                $settings[FluteSettings::KEY_TYPE_TO_SCHEMA_MAP],
                $modelSchemas
            );
        };

        $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) {
            return new ParametersMapper($container->get(JsonSchemasInterface::class));
        };

        $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) {
            /** @var JsonSchemasInterface $jsonSchemas */
            $jsonSchemas = $container->get(JsonSchemasInterface::class);
            $settings    = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);
            $encoder     = $factory
                ->createEncoder($jsonSchemas)
                ->withEncodeOptions($settings[FluteSettings::KEY_JSON_ENCODE_OPTIONS])
                ->withEncodeDepth($settings[FluteSettings::KEY_JSON_ENCODE_DEPTH])
                ->withUrlPrefix($settings[FluteSettings::KEY_URI_PREFIX]);
            isset($settings[FluteSettings::KEY_META]) ? $encoder->withMeta($settings[FluteSettings::KEY_META]) : null;
            ($settings[FluteSettings::KEY_IS_SHOW_VERSION] ?? false) ?
                $encoder->withJsonApiVersion(FluteSettings::DEFAULT_JSON_API_VERSION) : null;

            return $encoder;
        };

        $container[RelationshipPaginationStrategyInterface::class] = function (PsrContainerInterface $container) {
            $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class);

            return new BasicRelationshipPaginationStrategy($settings[FluteSettings::KEY_DEFAULT_PAGING_SIZE]);
        };

        $container[JsonApiParserFactoryInterface::class] = function (PsrContainerInterface $container) {
            $factory = new JsonApiParserFactory($container);

            return $factory;
        };

        $container[FormValidatorFactoryInterface::class] = function (PsrContainerInterface $container) {
            $factory = new FormValidatorFactory($container);

            return $factory;
        };

        // register date/date time types
        Type::hasType(DateTimeType::NAME) === true ?: Type::addType(DateTimeType::NAME, DateTimeType::class);
        Type::hasType(DateType::NAME) === true ?: Type::addType(DateType::NAME, DateType::class);
    }
323834
protected function bindInitialInstances(ContainerInterface $container)
	{
		foreach($this->komponents as $komponent)
		{
			$container->bindInstance(get_class($komponent), $komponent);
		}
	}
110068
protected function createPolicyEnforcementPoint(ContainerInterface $container): PolicyEnforcementPointInterface
    {
        $contextDefinitions = [
            ContextProperties::CTX_CONTAINER => $container,
        ];

        $pip = new PolicyInformationPoint($contextDefinitions);
        $pdp = new PolicyDecisionPoint($this->getPoliciesData());
        $pep = new PolicyEnforcementPoint($pip, $pdp);

        if ($this->logger !== null) {
            $pip->setLogger($this->logger);
            $pdp->setLogger($this->logger);
            $pep->setLogger($this->logger);
        }

        return $pep;
    }
686749
public function getSessionHandler(ContainerInterface $container): SessionHandlerInterface
    {
        $prefix = $container->get('ellipse.session.id.prefix');
        $ttl = $container->get('ellipse.session.ttl');
        $cache = $container->get('ellipse.session.cache');

        return new Psr6SessionHandler($cache, ['prefix' => $prefix, 'ttl' => $ttl]);
    }