MountebankException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 49
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A getSource() 0 4 1
A getData() 0 4 1
1
<?php
2
3
namespace Meare\Juggler\Exception\Mountebank;
4
5
6
/**
7
 * Wrapper mountebank errors, more info:
8
 * http://www.mbtest.org/docs/api/errors
9
 */
10
class MountebankException extends \Exception
11
{
12
    /**
13
     * @var string
14
     */
15
    private $source;
16
17
    /**
18
     * @var string
19
     */
20
    private $data;
21
22
    /**
23
     * MountebankException constructor.
24
     *
25
     * @param string          $message
26
     * @param string|null     $source
27
     * @param string|null     $data
28
     * @param int             $code
29
     * @param \Exception|null $previous
30
     */
31 3
    public function __construct($message, $source = null, $data = null, $code = 0, \Exception $previous = null)
32
    {
33 3
        $this->source = $source;
34 3
        $this->data = $data;
35
36
        $exception_message = $message
37 3
            . (isset($source) ? "; source: '$source'" : '')
38 3
            . (isset($data) ? " - $data" : '');
39
40 3
        parent::__construct($exception_message, $code, $previous);
41 3
    }
42
43
    /**
44
     * @return string
45
     */
46 1
    public function getSource()
47
    {
48 1
        return $this->source;
49
    }
50
51
    /**
52
     * @return string
53
     */
54 1
    public function getData()
55
    {
56 1
        return $this->data;
57
    }
58
}
59