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.

WorkEtcException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A buildMessage() 0 10 2
1
<?php
2
3
namespace WorkEtcClient;
4
5
class WorkEtcException extends \Exception
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $defaultMessage = 'Unknown error.';
11
12
    /**
13
     * @param array $response
14
     */
15
    public function __construct(array $response)
16
    {
17
        $message = $this->buildMessage($response);
18
19
        parent::__construct($message, 0);
20
    }
21
22
    /**
23
     * Attempt to extract the core message and encode the rest.
24
     *
25
     * @param array $response
26
     *
27
     * @return string
28
     */
29
    protected function buildMessage(array $response): string
30
    {
31
        $message = isset($response['Message'])
32
            ? $response['Message']
33
            : $this->defaultMessage;
34
35
        $message .= '; response = ' . json_encode($response);
36
37
        return $message;
38
    }
39
}
40