Completed
Pull Request — master (#52)
by John
02:41
created

ApiResponseErrorException::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Test;
10
11
/**
12
 * @author John Kleijn <[email protected]>
13
 */
14
class ApiResponseErrorException extends \Exception
15
{
16
    /**
17
     * @var object
18
     */
19
    private $data;
20
21
    /**
22
     * @var string
23
     */
24
    private $json;
25
26
    /**
27
     * @param string $json
28
     * @param object $data
29
     * @param int    $httpStatusCode
30
     */
31
    public function __construct($json, $data, $httpStatusCode)
32
    {
33
        $this->message = "Returned $httpStatusCode";
34
        if ($data) {
35
            $this->message = $data->message;
36
            if (isset($data->logref)) {
37
                $this->message = "$data->message [logref $data->logref]";
38
            }
39
40
        }
41
42
        $this->code = $httpStatusCode;
43
        $this->data = $data;
44
        $this->json = $json;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getJson()
51
    {
52
        return $this->json;
53
    }
54
55
    /**
56
     * @return object
57
     */
58
    public function getData()
59
    {
60
        return $this->data;
61
    }
62
}
63