Completed
Push — master ( f61680...98184f )
by Pavel
02:28
created

MockClientException::getResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace ScayTrase\Api\Rpc\Test;
4
5
use ScayTrase\Api\Rpc\Exception\RpcExceptionInterface;
6
use ScayTrase\Api\Rpc\RpcRequestInterface;
7
use ScayTrase\Api\Rpc\RpcResponseInterface;
8
9
class MockClientException extends \RuntimeException implements RpcExceptionInterface
10
{
11
    /** @var RpcRequestInterface */
12
    private $request;
13
    /** @var RpcResponseInterface */
14
    private $response;
15
16 2
    public static function emptyQueue(RpcRequestInterface $request)
17
    {
18 2
        $ex = new static(
19 2
            sprintf('Mock queue is empty while calling "%s"', $request->getMethod())
20 2
        );
21
22 2
        $ex->request = $request;
23
24 2
        return $ex;
25
    }
26
27 2
    public static function filterFailed(RpcRequestInterface $request, RpcResponseInterface $response)
28
    {
29 2
        $ex           = new static('Request structure declined by filter');
30 2
        $ex->request  = $request;
31 2
        $ex->response = $response;
32
33 2
        return $ex;
34
    }
35
36
    /**
37
     * @return RpcRequestInterface
38
     */
39 3
    public function getRequest()
40
    {
41 3
        return $this->request;
42
    }
43
44
    /**
45
     * @return RpcResponseInterface
46
     */
47 2
    public function getResponse()
48
    {
49 2
        return $this->response;
50
    }
51
}
52