1 | <?php |
||
11 | class IntegerDigitList extends AbstractDigitList |
||
12 | { |
||
13 | /** @var string List of digits for bases smaller than 63 */ |
||
14 | private static $integerBase = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
||
15 | |||
16 | /** @var string List of digits for base 64 */ |
||
17 | private static $integerBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
||
18 | |||
19 | /** |
||
20 | * Creates a new instance of IntegerDigitList. |
||
21 | * |
||
22 | * The digit list is defined by giving the radix (i.e. base) for the number |
||
23 | * system that defines the number of digits in the digit list. The actual |
||
24 | * digits are determined based on the given number. |
||
25 | * |
||
26 | * If the given radix is 62 or less, the digits from the list 0-9A-Za-z |
||
27 | * are used. The digits are case insensitive, if the radix is 36 or less. |
||
28 | * |
||
29 | * If the radix is 64, then the digits from the base64 standard are used. |
||
30 | * Base64 is always case sensitive. |
||
31 | * |
||
32 | * If the radix is 63 or 65 to 256, then digits are represented by a single |
||
33 | * byte with equal byte value. |
||
34 | * |
||
35 | * If the radix is 257 or greater, then each digit is represented by a |
||
36 | * string of #NNN (where NNN is the value of the digit). Each string has |
||
37 | * equal length, which depends on the given radix. |
||
38 | * |
||
39 | * @param int $radix Radix for the numeral system |
||
40 | * @throws \InvalidArgumentException If the radix is invalid |
||
41 | */ |
||
42 | 237 | public function __construct($radix) |
|
54 | |||
55 | /** |
||
56 | * Builds the list of digits according to the radix. |
||
57 | * @param int $radix Radix for the numeral system |
||
58 | * @return string[] The list of digits |
||
59 | */ |
||
60 | 234 | private function buildDigitList($radix) |
|
72 | |||
73 | /** |
||
74 | * Builds the list of digits for arbitrary radix. |
||
75 | * @param int $radix Radix for the numeral system |
||
76 | * @return string[] The list of digits |
||
77 | */ |
||
78 | 12 | private function buildArbitraryList($radix) |
|
86 | } |
||
87 |