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.

FrontController::frontpage()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 14
nc 4
nop 0
dl 0
loc 23
rs 9.4888
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\df_tools_decoupled\Controller;
4
5
use Drupal\Core\Controller\ControllerBase;
6
use Drupal\user\Form\UserLoginForm;
7
8
class FrontController extends ControllerBase {
9
10
  /**
11
   * Displays the login form on the homepage and redirects authenticated users.
12
   */
13
  public function frontpage() {
14
    $build = [];
15
    if ($this->currentUser()->isAnonymous()) {
16
      $build['form'] = $this->formBuilder()->getForm(UserLoginForm::class);
17
    }
18
    else {
19
      if (\Drupal::moduleHandler()->moduleExists('moderation_dashboard')
20
        && $this->currentUser()->hasPermission('use moderation dashboard')) {
21
          // Permitted users are directed to their moderation dashboard.
22
          return $this->redirect('view.moderation_dashboard.page_1', ['user' => $this->currentUser()->id()]);
23
      }
24
      elseif ($this->currentUser()->hasPermission('access content overview')) {
25
        // Permitted users are directed to the admin content page.
26
        return $this->redirect('view.content.page_1');
27
      }
28
      else {
29
        $build['heading'] = [
30
          '#type' => 'markup',
31
          '#markup' => $this->t('This site has no homepage content.'),
32
        ];
33
      }
34
    }
35
    return $build;
36
  }
37
}
38