Completed
Pull Request — master (#48)
by John
02:30
created

ApiResponseErrorException::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 7
nc 3
nop 2
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
     * @param object $json
18
     * @param int    $httpStatusCode
19
     */
20
    public function __construct($json, $httpStatusCode)
21
    {
22
        $this->message = "Returned $httpStatusCode";
23
        if ($json) {
24
            $this->message = $json->message;
25
            if (isset($json->logref)) {
26
                $this->message = "$json->message [logref $json->logref]";
27
            }
28
29
        }
30
31
        $this->code = $httpStatusCode;
32
    }
33
}
34