public function registerToContainer(ContainerBuilder $container, string $servicePrefix): void
    {
        $this->process();
        $servicePrefix = rtrim($servicePrefix, '.').'.';

        foreach ($this->sections as $name => $config) {
            $container->setParameter($servicePrefix.$name.'.is_secure', $config->isSecure);
            $container->setParameter($servicePrefix.$name.'.channel', $config->isSecure ? 'https' : null);
            $container->setParameter($servicePrefix.$name.'.domain', $config->domain);
            $container->setParameter($servicePrefix.$name.'.host', $config->host);
            $container->setParameter($servicePrefix.$name.'.host_pattern', $config->hostPattern);
            $container->setParameter($servicePrefix.$name.'.requirements', $config->requirements);
            $container->setParameter($servicePrefix.$name.'.defaults', $config->defaults);
            $container->setParameter($servicePrefix.$name.'.prefix', $config->prefix);
            $container->setParameter($servicePrefix.$name.'.path', $config->path);
            $container->register($servicePrefix.$name.'.request_matcher', RequestMatcher::class)->setArguments(
                [
                    $container->getParameterBag()->escapeValue($config->path),
                    $container->getParameterBag()->escapeValue($config->hostPattern),
                ]
            );
        }
    }
public function registerToContainer(ContainerBuilder $container, string $servicePrefix): void
    {
        $this->process();
        $servicePrefix = rtrim($servicePrefix, '.').'.';

        foreach ($this->sections as $name => $config) {
            $container->setParameter($servicePrefix.$name.'.is_secure', $config->isSecure);
            $container->setParameter($servicePrefix.$name.'.channel', $config->isSecure ? 'https' : null);
            $container->setParameter($servicePrefix.$name.'.domain', $config->domain);
            $container->setParameter($servicePrefix.$name.'.host', $config->host);
            $container->setParameter($servicePrefix.$name.'.host_pattern', $config->hostPattern);
            $container->setParameter($servicePrefix.$name.'.requirements', $config->requirements);
            $container->setParameter($servicePrefix.$name.'.defaults', $config->defaults);
            $container->setParameter($servicePrefix.$name.'.prefix', $config->prefix);
            $container->setParameter($servicePrefix.$name.'.path', $config->path);
            $container->register($servicePrefix.$name.'.request_matcher', RequestMatcher::class)->setArguments(
                [
                    $container->getParameterBag()->escapeValue($config->path),
                    $container->getParameterBag()->escapeValue($config->hostPattern),
                ]
            );
        }
    }
public function registerToContainer ( ContainerBuilder $ container , string $ servicePrefix ) : void { $ this -> process ( ) ; $ servicePrefix = rtrim ( $ servicePrefix , '.' ) . '.' ; foreach ( $ this -> sections as $ name => $ config ) { $ container -> setParameter ( $ servicePrefix . $ name . '.is_secure' , $ config -> isSecure ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.channel' , $ config -> isSecure ? 'https' : null ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.domain' , $ config -> domain ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.host' , $ config -> host ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.host_pattern' , $ config -> hostPattern ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.requirements' , $ config -> requirements ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.defaults' , $ config -> defaults ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.prefix' , $ config -> prefix ) ; $ container -> setParameter ( $ servicePrefix . $ name . '.path' , $ config -> path ) ; $ container -> register ( $ servicePrefix . $ name . '.request_matcher' , RequestMatcher :: class ) -> setArguments ( [ $ container -> getParameterBag ( ) -> escapeValue ( $ config -> path ) , $ container -> getParameterBag ( ) -> escapeValue ( $ config -> hostPattern ) , ] ) ; } }
Register the sections configuration as service-container parameters
and a RequestMatcher service.

The following pattern is used, where '{service-prefix}' is the value of $servicePrefix
and '{section-name}' the name the processed section (repeated for each registered section).

Like:

'{service-prefix}.{section-name}.is_secure'        => false
'{service-prefix}.{section-name}.channel'          => null
'{service-prefix}.{section-name}.host'             => 'example.com'
'{service-prefix}.{section-name}.host_pattern'     => '^example\.com$'
'{service-prefix}.{section-name}.prefix'           => '/'
'{service-prefix}.{section-name}.path'             => '^/(?!(backend|api)/)'
'{service-prefix}.{section-name}.request_matcher'  => {RequestMatcher service}

Note: when the host is empty the 'host_pattern' is null.

The `channel` is only set to 'https' when is_secure is true. This prevents forcing
an HTTP channel when HTTPS is used. HTTPS is only enforced when configured.

@param ContainerBuilder $container
@param string           $servicePrefix
Register the sections configuration as service - container parameters and a RequestMatcher service .