TimeoutException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequest() 0 3 1
A ofRequest() 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
namespace ArangoDb\Exception;
11
12
use Fig\Http\Message\StatusCodeInterface;
13
use Psr\Http\Client\NetworkExceptionInterface;
14
use Psr\Http\Message\RequestInterface;
15
16
final class TimeoutException extends RuntimeException implements NetworkExceptionInterface
17
{
18
    /**
19
     * @var RequestInterface
20
     */
21
    private $request;
22
23
    public static function ofRequest(RequestInterface $request): self
24
    {
25
        $self = new self(
26
            "Got a timeout while waiting for the server's response",
27
            StatusCodeInterface::STATUS_REQUEST_TIMEOUT
28
        );
29
        $self->request = $request;
30
        return $self;
31
    }
32
33
    public function getRequest(): RequestInterface
34
    {
35
        return $this->request;
36
    }
37
}
38