GuardErrorException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 20
ccs 6
cts 8
cp 0.75
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 3 1
A with() 0 8 1
1
<?php
2
/**
3
 * Sandro Keil (https://sandro-keil.de)
4
 *
5
 * @link      http://github.com/sandrokeil/arangodb-php-client for the canonical source repository
6
 * @copyright Copyright (c) 2018-2020 Sandro Keil
7
 * @license   http://github.com/sandrokeil/arangodb-php-client/blob/master/LICENSE.md New BSD License
8
 */
9
10
declare(strict_types=1);
11
12
namespace ArangoDb\Exception;
13
14
use Psr\Http\Message\ResponseInterface;
15
16
class GuardErrorException extends RuntimeException
17
{
18
    /**
19
     * @var ResponseInterface
20
     */
21
    private $response;
22
23 3
    public static function with(ResponseInterface $response): self
24
    {
25 3
        $self = new self(
26 3
            'A guard has an error detected.',
27 3
            $response->getStatusCode()
28
        );
29 3
        $self->response = $response;
30 3
        return $self;
31
    }
32
33
    public function getResponse(): ResponseInterface
34
    {
35
        return $this->response;
36
    }
37
}
38