DisabledDataException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 34
rs 10
ccs 9
cts 9
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getDataName() 0 3 1
1
<?php
2
/**
3
 * Swiss Payment Slip
4
 *
5
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
6
 * @copyright 2012-2016 Some nice Swiss guys
7
 * @author Marc Würth [email protected]
8
 * @author Manuel Reinhard <[email protected]>
9
 * @author Peter Siska <[email protected]>
10
 * @link https://github.com/ravage84/SwissPaymentSlip/
11
 */
12
13
namespace SwissPaymentSlip\SwissPaymentSlip\Exception;
14
15
/**
16
 * Exception when requesting disabled data
17
 */
18
class DisabledDataException extends PaymentSlipException
19
{
20
    /**
21
     * The name of the requested but disabled data
22
     *
23
     * @var null|string
24
     */
25
    protected $dataName = null;
26
27
    /**
28
     * Construct the message using the given data name
29
     *
30
     * @param string $dataName
31
     */
32 1
    public function __construct($dataName)
33
    {
34 1
        $this->dataName = $dataName;
35
36 1
        $message = sprintf(
37 1
            'You are accessing the disabled %s. You need to re-enable it first.',
38 1
            $dataName
39
        );
40
41 1
        parent::__construct($message);
42 1
    }
43
44
    /**
45
     * Get the name of the requested but disabled data
46
     *
47
     * @return null|string The name of the requested but disabled data.
48
     */
49 1
    public function getDataName()
50
    {
51 1
        return $this->dataName;
52
    }
53
}
54