Completed
Push — master ( 299ff6...6578e4 )
by Sandro
18s queued 12s
created

UnexpectedResponse   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 9
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getResponse() 0 3 1
A forType() 0 7 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 ArangoDb\Type\Type;
15
use Psr\Http\Message\ResponseInterface;
16
17
class UnexpectedResponse extends RuntimeException
18
{
19
    /**
20
     * @var Type
21
     */
22
    private $type;
23
24
    /**
25
     * @var ResponseInterface
26
     */
27
    private $response;
28
29
    public static function forType(Type $type, ResponseInterface $response): self
30
    {
31
        $self = new self('Unexpected response data.');
32
        $self->type = $type;
33
        $self->response = $response;
34
35
        return $self;
36
    }
37
38
    public function getType(): Type
39
    {
40
        return $this->type;
41
    }
42
43
    public function getResponse(): ResponseInterface
44
    {
45
        return $this->response;
46
    }
47
}
48