Completed
Pull Request — master (#42)
by Andreas
06:29
created

UnexpectedRequestException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromRequest() 0 8 1
A getRequest() 0 4 1
1
<?php
2
3
namespace Http\Mock\Exception;
4
5
use Psr\Http\Message\RequestInterface;
6
7
class UnexpectedRequestException extends \RuntimeException
8
{
9
    /**
10
     * @var RequestInterface|null
11
     */
12
    private $request;
13
14
    /**
15
     * @param RequestInterface $request
16
     *
17
     * @return self
18
     */
19
    public static function fromRequest(RequestInterface $request)
20
    {
21
        $instance = new self('Did not expect request to be sent');
22
23
        $instance->request = $request;
24
25
        return $instance;
26
    }
27
28
    /**
29
     * @return RequestInterface|null
30
     */
31
    public function getRequest()
32
    {
33
        return $this->request;
34
    }
35
}
36