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.

RouteSubscriber   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 3 1
A alterRoutes() 0 6 1
1
<?php
2
3
namespace Drupal\df_tools_workflow\Routing;
4
5
use Drupal\Core\Routing\RouteSubscriberBase;
6
use Drupal\Core\Routing\RoutingEvents;
7
use Symfony\Component\Routing\RouteCollection;
8
9
/**
10
 * Class RouteSubscriber.
11
 *
12
 * @package Drupal\df_tools_workflow\Routing
13
 * Listens to the dynamic route events.
14
 */
15
class RouteSubscriber extends RouteSubscriberBase {
16
17
  /**
18
   * {@inheritdoc}
19
   */
20
  public static function getSubscribedEvents() {
21
    $events[RoutingEvents::ALTER] = ['onAlterRoutes',-9999];  // negative Values means "late"
0 ignored issues
show
Comprehensibility Best Practice introduced by
$events was never initialized. Although not strictly required by PHP, it is generally a good practice to add $events = array(); before regardless.
Loading history...
22
    return $events;
23
  }
24
25
  /**
26
   * {@inheritdoc}
27
   */
28
  protected function alterRoutes(RouteCollection $collection) {
29
    $collection->get('entity.node.latest_version')->setRequirements([
30
      '_entity_access' => 'node.view',
31
      '_permission' => 'view latest version,view any unpublished content',
32
      'node' => "\d+",
33
      '_method' => 'GET|POST|OPTIONS'
34
    ]);
35
  }
36
}
37