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.

AbstractBillInterpreter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isValid() 0 3 1
1
<?php
2
3
namespace BillingBoss;
4
5
use BillingBoss\BillContext;
6
use BillingBoss\BillInterpreter;
7
8
/**
9
 * An abstract class that implements BillInterpreter
10
 *
11
 * @package BillingBoss
12
 * @link      https://github.com/ranskills/billing-boss-php
13
 * @copyright Copyright (c) 2018 Ransford Ako Okpoti
14
 * @license   Refer to the LICENSE distributed with this library
15
 * @since     1.0.0
16
 */
17
abstract class AbstractBillInterpreter implements BillInterpreter
18
{
19
    protected $regex;
20
    protected $matches = [];
21
22 19
    public function __construct(string $regex)
23
    {
24 19
        $this->regex = $regex;
25 19
    }
26
27
28
    abstract public function interpret(BillContext $context): float;
29
30 13
    public function isValid(BillContext $context): bool
31
    {
32 13
        return preg_match($this->regex, $context->getStructure(), $this->matches) === 1;
33
    }
34
}
35