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.

SiteInfoResource   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 11 3
1
<?php
2
3
namespace Drupal\df_tools_services\Plugin\rest\resource;
4
5
use Drupal\rest\Plugin\ResourceBase;
6
use Symfony\Component\HttpFoundation\JsonResponse;
7
8
/**
9
 * Provides a resource for retrieving basic site information.
10
 *
11
 * @RestResource(
12
 *   id = "site_info",
13
 *   label = @Translation("Site Info"),
14
 *   uri_paths = {
15
 *     "canonical" = "/site_api/site_info"
16
 *   }
17
 * )
18
 */
19
class SiteInfoResource extends ResourceBase {
20
21
  /**
22
   * Responds to GET requests.
23
   *
24
   * @return \Symfony\Component\HttpFoundation\JsonResponse
25
   */
26
  public function get() {
27
    $theme = \Drupal::config('system.theme')->get('default');
28
    $site_name = \Drupal::config('system.site')->get('name');
29
    $logo = theme_get_setting('logo', $theme);
30
    $theme_palette = color_get_palette($theme);
31
    $response = [
32
      'site_name' => $site_name,
33
      'theme_palette' => is_array($theme_palette) ? $theme_palette : [],
34
      'logo' => is_array($logo) ? $logo : [],
35
    ];
36
    return new JsonResponse($response);
37
  }
38
39
}
40