Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
24 | 54 | public function __construct($digits) |
|
25 | { |
||
26 | 54 | if (strlen($digits) < 2) { |
|
27 | 3 | throw new \InvalidArgumentException('Number base needs at least 2 characters'); |
|
28 | 51 | } elseif (strlen(count_chars($digits, 3)) !== strlen($digits)) { |
|
29 | 3 | throw new \InvalidArgumentException('Number base cannot have duplicate characters'); |
|
30 | } |
||
31 | |||
32 | 48 | $this->digits = str_split($digits); |
|
33 | 48 | $this->stringConflict = false; |
|
34 | 48 | $this->setValueMap(array_flip($this->digits)); |
|
35 | 48 | } |
|
36 | } |
||
37 |