Completed
Pull Request — master (#1)
by Harry
03:02
created

RuntimeException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 32
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getInstance() 0 4 1
1
<?php
2
3
namespace Graze\DogStatsD\Exception;
4
5
use Exception;
6
use Graze\DogStatsD\Client;
7
8
class RuntimeException extends \RuntimeException
9
{
10
    /**
11
     * Client instance that threw the exception
12
     *
13
     * @var Client
14
     */
15
    protected $instance;
16
17
    /**
18
     * Create new instance
19
     *
20
     * @param Client         $instance Client instance that threw the exception
21
     * @param string|null    $message  Exception message
22
     * @param Exception|null $previous Previous Exception
23
     */
24 5
    public function __construct(Client $instance, $message = '', Exception $previous = null)
25
    {
26 5
        $this->instance = $instance;
27 5
        parent::__construct($message, 0, $previous);
28 5
    }
29
30
    /**
31
     * Get Client instance that threw the exception
32
     *
33
     * @return Client Client instance
34
     */
35 2
    public function getInstance()
36
    {
37 2
        return $this->instance;
38
    }
39
}
40