Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/CoreServiceProvider.php
- 9 core/lib/Drupal/Core/CoreServiceProvider.php
Namespace
Drupal\Core
File
core/lib/Drupal/Core/CoreServiceProvider.php
View source
<?php
namespace Drupal\Core;
use Drupal\Core\Cache\Context\CacheContextsPass;
use Drupal\Core\Cache\ListCacheBinsPass;
use Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass;
use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass;
use Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass;
use Drupal\Core\DependencyInjection\Compiler\DeprecatedServicePass;
use Drupal\Core\DependencyInjection\Compiler\DevelopmentSettingsPass;
use Drupal\Core\DependencyInjection\Compiler\LoggerAwarePass;
use Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass;
use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass;
use Drupal\Core\DependencyInjection\Compiler\StackedKernelPass;
use Drupal\Core\DependencyInjection\Compiler\StackedSessionHandlerPass;
use Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass;
use Drupal\Core\DependencyInjection\Compiler\TwigExtensionPass;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
use Drupal\Core\DependencyInjection\ServiceProviderInterface;
use Drupal\Core\Plugin\PluginManagerPass;
use Drupal\Core\Render\MainContent\MainContentRenderersPass;
use Drupal\Core\Site\Settings;
use Psr\Log\LoggerAwareInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CoreServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
public function register(ContainerBuilder $container) {
$this
->registerTest($container);
if (Settings::get('file_private_path')) {
$container
->register('stream_wrapper.private', 'Drupal\\Core\\StreamWrapper\\PrivateStream')
->addTag('stream_wrapper', [
'scheme' => 'private',
]);
}
$container
->addCompilerPass(new ModifyServiceDefinitionsPass());
$container
->addCompilerPass(new DevelopmentSettingsPass());
$container
->addCompilerPass(new ProxyServicesPass());
$container
->addCompilerPass(new BackendCompilerPass());
$container
->addCompilerPass(new CorsCompilerPass());
$container
->addCompilerPass(new StackedKernelPass());
$container
->addCompilerPass(new StackedSessionHandlerPass());
$container
->addCompilerPass(new MainContentRenderersPass());
$container
->addCompilerPass(new TaggedHandlersPass());
$container
->addCompilerPass(new RegisterStreamWrappersPass());
$container
->addCompilerPass(new TwigExtensionPass());
$container
->addCompilerPass(new RegisterEventSubscribersPass(), PassConfig::TYPE_AFTER_REMOVING);
$container
->addCompilerPass(new LoggerAwarePass(), PassConfig::TYPE_AFTER_REMOVING);
$container
->addCompilerPass(new RegisterAccessChecksPass());
$container
->addCompilerPass(new RegisterServicesForDestructionPass());
$container
->addCompilerPass(new ListCacheBinsPass());
$container
->addCompilerPass(new CacheContextsPass());
$container
->addCompilerPass(new AuthenticationProviderPass());
$container
->addCompilerPass(new PluginManagerPass());
$container
->addCompilerPass(new DeprecatedServicePass());
$container
->registerForAutoconfiguration(EventSubscriberInterface::class)
->addTag('event_subscriber');
$container
->registerForAutoconfiguration(LoggerAwareInterface::class)
->addTag('logger_aware');
}
public function alter(ContainerBuilder $container) {
$uuid_service = $container
->getDefinition('uuid');
if (function_exists('uuid_create') && !function_exists('uuid_make')) {
$uuid_service
->setClass('Drupal\\Component\\Uuid\\Pecl');
}
elseif (function_exists('com_create_guid')) {
$uuid_service
->setClass('Drupal\\Component\\Uuid\\Com');
}
}
protected function registerTest(ContainerBuilder $container) {
if (!drupal_valid_test_ua()) {
return;
}
if (!defined('DRUPAL_TEST_IN_CHILD_SITE')) {
return;
}
$container
->register('test.http_client.middleware', 'Drupal\\Core\\Test\\HttpClientMiddleware\\TestHttpClientMiddleware')
->addTag('http_client_middleware');
$container
->register('test.http_middleware.wait_terminate_middleware', 'Drupal\\Core\\Test\\StackMiddleware\\TestWaitTerminateMiddleware')
->setArguments([
new Reference('state'),
new Reference('lock'),
])
->addTag('http_middleware', [
'priority' => -1024,
]);
}
}
Classes