Total Complexity | 4 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
14 | trait BaseConversionTrait { |
||
15 | |||
16 | use AbstractTrait; |
||
17 | |||
18 | /** |
||
19 | * Convert between arbitrary bases. |
||
20 | * |
||
21 | * `CONV($this,$from,$to)` |
||
22 | * |
||
23 | * @param int $from |
||
24 | * @param int $to |
||
25 | * @return Text |
||
26 | */ |
||
27 | public function toBase (int $from, int $to) { |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Convert from an arbitrary base to base 16. |
||
33 | * |
||
34 | * `CONV($this,$from,16)` |
||
35 | * |
||
36 | * @param int $from |
||
37 | * @return Text |
||
38 | */ |
||
39 | public function toBase16 (int $from = 10) { |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Convert from an arbitrary base to base 2. |
||
45 | * |
||
46 | * `CONV($this,$from,2)` |
||
47 | * |
||
48 | * @param int $from |
||
49 | * @return Text |
||
50 | */ |
||
51 | public function toBase2 (int $from = 10) { |
||
52 | return $this->toBase($from, 2); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Convert from an arbitrary base to base 8. |
||
57 | * |
||
58 | * `CONV($this,$from,8)` |
||
59 | * |
||
60 | * @param int $from |
||
61 | * @return Text |
||
62 | */ |
||
63 | public function toBase8 (int $from = 10) { |
||
65 | } |
||
66 | } |
||
67 |