Completed
Push — master ( 6578e4...b57e95 )
by Sandro
27s queued 17s
created

GuardErrorException::getResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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