ConnectionException::forRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 3
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
namespace ArangoDb\Exception;
11
12
use Psr\Http\Client\NetworkExceptionInterface;
13
use Psr\Http\Message\RequestInterface;
14
15
final class ConnectionException extends RuntimeException implements NetworkExceptionInterface
16
{
17
    /**
18
     * @var RequestInterface
19
     */
20
    private $request;
21
22
    public static function forRequest(RequestInterface $request, string $message, int $code): self
23
    {
24
        $self = new self($message, $code);
25
        $self->request = $request;
26
        return $self;
27
    }
28
29
    public function getRequest(): RequestInterface
30
    {
31
        return $this->request;
32
    }
33
}
34