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

RuntimeException::getInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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