GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BillContext   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 61
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setAmount() 0 4 1
A getStructure() 0 3 1
A __construct() 0 4 1
A getAmount() 0 3 1
A setStructure() 0 4 1
1
<?php
2
declare(strict_types=1);
3
namespace BillingBoss;
4
5
/**
6
 * Class BillContext
7
 *
8
 * @category BillingBoss
9
 * @package  BillingBoss
10
 * @author   Ransford Okpoti <[email protected]>
11
 * @license  https://opensource.org/licenses/MIT MIT
12
 * @link     https://github.com/ranskills/billing-boss-php
13
 * @since    1.0.0
14
 */
15
final class BillContext
16
{
17
    private $amount;
18
    private $structure;
19
20
    /**
21
     * Constructor
22
     *
23
     * @param float  $amount    The amount to be billed
24
     * @param string $structure The billing structure to be applied on $amount
25
     */
26 22
    public function __construct(float $amount, string $structure)
27
    {
28 22
        $this->amount = $amount;
29 22
        $this->setStructure($structure);
30 22
    }
31
32
    /**
33
     * Returns the amount
34
     *
35
     * @return float
36
     */
37 6
    public function getAmount(): float
38
    {
39 6
        return $this->amount;
40
    }
41
42
    /**
43
     * Sets the amount and returns this instance
44
     *
45
     * @param float $amount The amount to be billed
46
     *
47
     * @return BillContext
48
     */
49 5
    public function setAmount(float $amount)
50
    {
51 5
        $this->amount = $amount;
52 5
        return $this;
53
    }
54
55
    /**
56
     * Returns the structure for this context
57
     *
58
     * @return string
59
     */
60 22
    public function getStructure(): string
61
    {
62 22
        return $this->structure;
63
    }
64
65
    /**
66
     * Sets the billing structure for the context
67
     *
68
     * @param string $structure The billing structure
69
     *
70
     * @return BillContext
71
     */
72 22
    public function setStructure(string $structure)
73
    {
74 22
        $this->structure = trim(preg_replace('/\s+/', ' ', $structure));
75 22
        return $this;
76
    }
77
}
78