Issues (645)

src/EventSubscriber/SubrequestSubscriber.php (3 issues)

1
<?php
2
3
namespace Drupal\graphql\EventSubscriber;
4
5
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
0 ignored issues
show
The type Symfony\Component\EventD...ventSubscriberInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\HttpKernel\Event\RequestEvent;
0 ignored issues
show
The type Symfony\Component\HttpKernel\Event\RequestEvent was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\HttpKernel\KernelEvents;
0 ignored issues
show
The type Symfony\Component\HttpKernel\KernelEvents was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Remap artificial requests to subrequest extraction controller.
11
 */
12
class SubrequestSubscriber implements EventSubscriberInterface {
13
14
  /**
15
   * Handle kernel request events.
16
   *
17
   * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
18
   *   The kernel event object.
19
   */
20
  public function onKernelRequest(RequestEvent $event) {
21
    $request = $event->getRequest();
22
    if ($request->attributes->has('_graphql_subrequest')) {
23
      $request->attributes->set('_graphql_controller', $request->attributes->get('_controller'));
24
      $request->attributes->set('_controller', '\Drupal\graphql\Controller\SubrequestExtractionController:extract');
25
    }
26
  }
27
28
  /**
29
   * {@inheritdoc}
30
   */
31
  public static function getSubscribedEvents() {
32
    return [KernelEvents::REQUEST => 'onKernelRequest'];
33
  }
34
35
}
36