DisabledDataException::getDataName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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