Completed
Pull Request — master (#30)
by
unknown
09:53
created

JsonHttpException::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace AppBundle\Exception;
4
5
use Symfony\Component\HttpKernel\Exception\HttpException;
6
7
class JsonHttpException extends HttpException
8
{
9
    /**
10
     * @var array
11
     */
12
    private $data;
13
14
    /**
15
     * @param int    $statusCode
16
     * @param string $message
17
     * @param mixed  $data
18
     */
19 5
    public function __construct($statusCode, $message = null, $data = [])
20
    {
21 5
        parent::__construct($statusCode, $message);
22
23 5
        $this->setData($data);
24 5
    }
25
26
    /**
27
     * @return array
28
     */
29 5
    public function getData()
30
    {
31 5
        return $this->data;
32
    }
33
34
    /**
35
     * @param array $data
36
     *
37
     * @return $this
38
     */
39 5
    public function setData($data)
40
    {
41 5
        $this->data = $data;
42
43 5
        return $this;
44
    }
45
}
46