Completed
Push — master ( 668be8...2d79c6 )
by Peter
03:52
created

NotModifiedException::getStatusCode()   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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2014, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Exception;
10
11
use Symfony\Component\HttpFoundation\Response;
12
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
13
14
class NotModifiedException extends \Exception implements HttpExceptionInterface
15
{
16
    /**
17
     * @var Response
18
     */
19
    protected $response;
20
21
    /**
22
     * @param Response $response
23
     * @param int $code
24
     * @param \Exception|null $previous
25
     */
26 3
    public function __construct(Response $response, $code = 0, \Exception $previous = null)
27
    {
28 3
        $this->response = $response;
29
30 3
        parent::__construct(
31 3
            Response::$statusTexts[$response->getStatusCode()],
32 3
            $code ?: $response->getStatusCode(),
33
            $previous
34 3
        );
35 3
    }
36
37
    /**
38
     * @return Response
39
     */
40 2
    public function getResponse()
41
    {
42 2
        return $this->response;
43
    }
44
45
    /**
46
     * @return int
47
     */
48 1
    public function getStatusCode()
49
    {
50 1
        return $this->response->getStatusCode();
51
    }
52
53
    /**
54
     * @return array
55
     */
56 1
    public function getHeaders()
57
    {
58 1
        return $this->response->headers->all();
59
    }
60
}
61