Completed
Pull Request — master (#5)
by
unknown
08:52
created

Base   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateNumber() 0 8 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace byrokrat\checkdigit;
6
7
abstract class Base
8
{
9
    /**
10
     * Validate number sructure, returns number if structure is valid
11
     *
12
     * @throws InvalidStructureException If $number is not numerical
13
     */
14
    protected function validateNumber(string $number)
15
    {
16
        if (!ctype_digit($number)) {
17
            throw new InvalidStructureException(
18
                "Number can only contain numerical characters, found <$number>"
19
            );
20
        }
21
    }
22
}
23