Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / tests / modules / service_provider_test / src / ServiceProviderTestServiceProvider.php
1 <?php
2
3 namespace Drupal\service_provider_test;
4
5 use Drupal\Core\DependencyInjection\ContainerBuilder;
6 use Drupal\Core\DependencyInjection\ServiceModifierInterface;
7 use Drupal\Core\Site\Settings;
8
9 class ServiceProviderTestServiceProvider implements ServiceModifierInterface {
10
11   /**
12    * {@inheritdoc}
13    */
14   public function alter(ContainerBuilder $container) {
15     if ($container->has('file.usage')) {
16       // Override the class used for the file.usage service.
17       $definition = $container->getDefinition('file.usage');
18       $definition->setClass('Drupal\service_provider_test\TestFileUsage');
19     }
20
21     if ($indicator = Settings::get('deployment_identifier')) {
22       $container->setParameter('container_rebuild_indicator', $indicator);
23     }
24
25     if ($parameter = Settings::get('container_rebuild_test_parameter')) {
26       $container->setParameter('container_rebuild_test_parameter', $parameter);
27     }
28   }
29
30 }