GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

onKernelRequestMenuRouterRebuild()   B
last analyzed

Complexity

Conditions 7
Paths 5

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
rs 8.8333
c 0
b 0
f 0
cc 7
nc 5
nop 1
1
<?php
2
3
namespace Drupal\df_core\EventSubscriber;
4
5
use Symfony\Component\HttpKernel\KernelEvents;
6
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
9
/**
10
 * Rebuilds the menu router to ensure image derivatives are created.
11
 */
12
class MenuRouterRebuildSubscriber implements EventSubscriberInterface {
13
14
  /**
15
   * Rebuilds the menu router if the rebuild.dat file is found.
16
   *
17
   * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
18
   *   The Event to process.
19
   */
20
  public function onKernelRequestMenuRouterRebuild(GetResponseEvent $event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

20
  public function onKernelRequestMenuRouterRebuild(/** @scrutinizer ignore-unused */ GetResponseEvent $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    if (file_exists("public://rebuild.dat")) {
22
      $site_path = preg_replace('/^sites\//', '', \Drupal::service('site.path'));
23
      if (!file_exists('public://.drushrc') && file_exists('public://') && is_writable('public://') && file_put_contents('public:///.drushrc', "<?php\n\$options['l'] = 'http://${site_path}';")) {
24
        drupal_chmod('public:///.drushrc', 0444);
0 ignored issues
show
Deprecated Code introduced by
The function drupal_chmod() has been deprecated: in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystem::chmod(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

24
        /** @scrutinizer ignore-deprecated */ drupal_chmod('public:///.drushrc', 0444);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
25
      }
26
27
      if (\Drupal::service('router.builder')->rebuild()) {
28
        file_unmanaged_delete("public://rebuild.dat");
0 ignored issues
show
Deprecated Code introduced by
The function file_unmanaged_delete() has been deprecated: in Drupal 8.7.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::delete(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

28
        /** @scrutinizer ignore-deprecated */ file_unmanaged_delete("public://rebuild.dat");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
29
      }
30
    }
31
  }
32
33
  /**
34
   * {@inheritdoc}
35
   */
36
  static function getSubscribedEvents() {
37
    $events = [];
38
    $events[KernelEvents::REQUEST][] = ['onKernelRequestMenuRouterRebuild', 255];
39
    return $events;
40
  }
41
42
}
43