3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter;
5 use Drupal\drupalmoduleupgrader\ConverterBase;
6 use Drupal\drupalmoduleupgrader\TargetInterface;
7 use Pharborist\Functions\ParameterNode;
12 * description = @Translation("Converts Drupal 7's hook_boot() to an EventSubscriber."),
16 class HookBoot extends ConverterBase {
21 public function convert(TargetInterface $target) {
22 $this->writeService($target, 'boot_subscriber', [
23 'class' => 'Drupal\\' . $target->id() . '\\EventSubscriber\\BootSubscriber',
25 [ 'name' => 'event_subscriber' ],
30 '#theme' => 'dmu_event_subscriber',
31 '#module' => $target->id(),
32 '#class' => 'BootSubscriber',
33 '#event' => 'KernelEvents::REQUEST',
35 $subscriber = $this->parse($render);
38 ->getIndexer('function')
40 ->cloneAsMethodOf($subscriber)
42 ->appendParameter(ParameterNode::create('event')
43 ->setTypeHint('\Symfony\Component\HttpKernel\Event\GetResponseEvent')
46 $this->writeClass($target, $subscriber);