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.

LastRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 95.24%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 60
ccs 20
cts 21
cp 0.9524
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getLinks() 0 15 3
1
<?php
2
3
namespace BoletoSimples;
4
5
class LastRequest {
6
  /**
7
   * Content of response header Total
8
   */
9
  public $total = null;
10
11
  /**
12
   * Content of response header X-Ratelimit-Limit
13
   */
14
  public $ratelimit_limit = null;
15
16
  /**
17
   * Content of response header X-Ratelimit-Remaining
18
   */
19
  public $ratelimit_remaining = null;
20
21
  /**
22
   * Array with links returned on header Link
23
   */
24
  public $links = null;
25
26
  /**
27
   * GuzzleHttp\Message\Request object
28
   */
29
  public $request = null;
30
31
  /**
32
   * GuzzleHttp\Message\Response object
33
   */
34
  public $response = null;
35
36
  /**
37
   * Constructor method.
38
   */
39 1
  public function __construct($request, $response) {
40 1
    $this->request = $request;
41 1
    $this->response = $response;
42
43 1
    $this->total = $response->getHeader('Total');
44 1
    $this->ratelimit_limit = $response->getHeader('X-Ratelimit-Limit');
45 1
    $this->ratelimit_remaining = $response->getHeader('X-Ratelimit-Remaining');
46 1
    $this->links = $this->getLinks($response);
47 1
  }
48
49 1
  private function getLinks($response) {
50 1
    $link_header = $response->getHeader('Link');
51 1
    if ($link_header == null) {
52
      return [];
53
    }
54 1
    $links = [];
55 1
    foreach (explode(', ', $link_header) as $link) {
56 1
      preg_match('/rel=\"(.*)\"/', $link, $matches);
57 1
      $key = $matches[1];
58 1
      preg_match('/\<(.*)\>/', $link, $matches);
59 1
      $value = $matches[1];
60 1
      $links[$key] = $value;
61 1
    }
62 1
    return $links;
63
  }
64
}