{% import '@lib/di.twig' as di %}
<?php

declare(strict_types=1);

namespace Drupal\{{ machine_name }}\EventSubscriber;

{% apply sort_namespaces %}
  {% if services %}
{{ di.use(services) }}
  {% endif %}
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
{% endapply %}

/**
 * @todo Add description for this subscriber.
 */
final class {{ class }} implements EventSubscriberInterface {
{% if services %}

  /**
   * Constructs {{ class|article }} object.
   */
  public function __construct(
{{ di.signature(services) }}
  ) {}
{% endif %}

  /**
   * Kernel request event handler.
   */
  public function onKernelRequest(RequestEvent $event): void {
    // @todo Place your code here.
{% if SUT_TEST %}
    $this->messenger->addStatus(__FUNCTION__);
{% endif %}
  }

  /**
   * Kernel response event handler.
   */
  public function onKernelResponse(ResponseEvent $event): void {
    // @todo Place your code here.
{% if SUT_TEST %}
    $this->messenger->addStatus(__FUNCTION__);
{% endif %}
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents(): array {
    return [
      KernelEvents::REQUEST => ['onKernelRequest'],
      KernelEvents::RESPONSE => ['onKernelResponse'],
    ];
  }

}
