Reason   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
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 20
ccs 7
cts 7
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 3 1
A __construct() 0 3 1
A ensureValidValue() 0 3 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2020, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge\modifiers\addons;
12
13
use hiqdev\php\billing\charge\modifiers\AddonInterface;
14
15
/**
16
 * Reason addon.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class Reason implements AddonInterface
21
{
22
    /**
23
     * @var string
24
     */
25
    protected $value;
26
27 7
    public function __construct($value)
28
    {
29 7
        $this->value = static::ensureValidValue($value);
30 7
    }
31
32 6
    public function getValue()
33
    {
34 6
        return $this->value;
35
    }
36
37 7
    public static function ensureValidValue($value)
38
    {
39 7
        return (string) $value;
40
    }
41
}
42