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

ApiResponseErrorException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
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