Yaffs site version 1.1
[yaffs-website] / vendor / drush / drush / lib / Drush / Drupal / DrushServiceModifier.php
1 <?php
2
3 namespace Drush\Drupal;
4
5 use Drush\Log\LogLevel;
6 use Drupal\Core\DependencyInjection\ServiceModifierInterface;
7 use Drupal\Core\DependencyInjection\ContainerBuilder;
8
9 class DrushServiceModifier implements ServiceModifierInterface
10 {
11     /**
12      * @inheritdoc
13      */
14     public function alter(ContainerBuilder $container) {
15         drush_log(dt("service modifier alter"), LogLevel::DEBUG);
16         // http://symfony.com/doc/2.7/components/dependency_injection/tags.html#register-the-pass-with-the-container
17         $container->register('drush.service.consolecommands', 'Drush\Command\ServiceCommandlist');
18         $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolecommands', 'drush.command'));
19         $container->register('drush.service.consolidationcommands', 'Drush\Command\ServiceCommandlist');
20         $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolidationcommands', 'consolidation.commandhandler'));
21     }
22   /**
23    * Checks existing service definitions for the presence of modification.
24    *
25    * @param $container_definition
26    *   Cached container definition
27    * @return bool
28    */
29     public function check($container_definition) {
30       return isset($container_definition['services']['drush.service.consolecommands']) &&
31         isset($container_definition['services']['drush.service.consolidationcommands']);
32     }
33 }