RuntimeException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 30
rs 10
ccs 6
cts 6
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getInstance() 0 3 1
1
<?php
2
/**
3
 * This file is part of graze/dog-statsd
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/dog-statsd/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/dog-statsd
12
 */
13
14
namespace Graze\DogStatsD\Exception;
15
16
use Exception;
17
use Graze\DogStatsD\Client;
18
19
class RuntimeException extends \RuntimeException
20
{
21
    /**
22
     * Client instance id that threw the exception
23
     *
24
     * @var string
25
     */
26
    protected $instance;
27
28
    /**
29
     * Create new instance
30
     *
31
     * @param string         $instance Client instance that threw the exception
32
     * @param string|null    $message  Exception message
33
     * @param Exception|null $previous Previous Exception
34
     */
35 13
    public function __construct($instance, $message = '', Exception $previous = null)
36
    {
37 13
        $this->instance = $instance;
38 13
        parent::__construct($message, 0, $previous);
39 13
    }
40
41
    /**
42
     * Get instance name that threw the exception
43
     *
44
     * @return string Instance name
45
     */
46 2
    public function getInstance()
47
    {
48 2
        return $this->instance;
49
    }
50
}
51