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.
Completed
Pull Request — master (#12)
by Wade
02:47
created

BadRequest::getDropboxCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Dropbox\Exceptions;
4
5
use Exception;
6
use Psr\Http\Message\ResponseInterface;
7
8
class BadRequest extends Exception
9
{
10
    /**
11
     * The dropbox error code supplied in the response
12
     *
13
     * @var string
14
     */
15
    protected $dropboxCode = '';
16
17
    public function __construct(ResponseInterface $response)
18
    {
19
        $body = json_decode($response->getBody(), true);
20
21
        if ($response->getStatusCode() === 409) {
22
            $this->setDropboxCode($body['error']['.tag']);
23
        }
24
25
        parent::__construct($body['error_summary']);
26
    }
27
28
    protected function setDropboxCode(string $code)
29
    {
30
        $this->dropboxCode = $code;
31
    }
32
33
    /**
34
     * Returns the machine readable dropbox error code
35
     *
36
     * @return string
37
     */
38
    public function getDropboxCode(): string
39
    {
40
        return $this->dropboxCode;
41
    }
42
}
43