Passed
Push — master ( 5911e9...52488d )
by Joao Gilberto
31s
created

BaseException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getBody() 0 4 1
A setBody() 0 4 1
1
<?php
2
/**
3
 * User: jg
4
 * Date: 23/05/17
5
 * Time: 15:27
6
 */
7
8
namespace ByJG\Swagger\Exception;
9
10
class BaseException extends \Exception
11
{
12
    protected $body;
13
14
    public function __construct($message = "", $body = [], $code = 0, \Throwable $previous = null)
15
    {
16
        $this->body = $body;
17
        if (!empty($body)) {
18
            $message = $message . " ->\n" . json_encode($body, JSON_PRETTY_PRINT) . "\n";
19
        }
20
        parent::__construct($message, $code, $previous);
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26
    public function getBody()
27
    {
28
        return $this->body;
29
    }
30
31
    /**
32
     * @param mixed $body
33
     */
34
    public function setBody($body)
35
    {
36
        $this->body = $body;
37
    }
38
}
39