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