Merge branch '3.1' into 5.2
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / api / leafo / scssphp / src / SourceMap / Base64.php
CommitLineData
4318295b
AE
1<?php
2/**
3 * SCSSPHP
4 *
5 * @copyright 2012-2015 Leaf Corcoran
6 *
7 * @license http://opensource.org/licenses/MIT MIT
8 *
9 * @link http://leafo.github.io/scssphp
10 */
11
12namespace Leafo\ScssPhp\SourceMap;
13
14/**
15 * Base 64 Encode/Decode
16 *
17 * @author Anthon Pang <anthon.pang@gmail.com>
18 */
19class Base64
20{
21 /**
22 * @var array
23 */
24 private static $encodingMap = [
25 0 => 'A',
26 1 => 'B',
27 2 => 'C',
28 3 => 'D',
29 4 => 'E',
30 5 => 'F',
31 6 => 'G',
32 7 => 'H',
33 8 => 'I',
34 9 => 'J',
35 10 => 'K',
36 11 => 'L',
37 12 => 'M',
38 13 => 'N',
39 14 => 'O',
40 15 => 'P',
41 16 => 'Q',
42 17 => 'R',
43 18 => 'S',
44 19 => 'T',
45 20 => 'U',
46 21 => 'V',
47 22 => 'W',
48 23 => 'X',
49 24 => 'Y',
50 25 => 'Z',
51 26 => 'a',
52 27 => 'b',
53 28 => 'c',
54 29 => 'd',
55 30 => 'e',
56 31 => 'f',
57 32 => 'g',
58 33 => 'h',
59 34 => 'i',
60 35 => 'j',
61 36 => 'k',
62 37 => 'l',
63 38 => 'm',
64 39 => 'n',
65 40 => 'o',
66 41 => 'p',
67 42 => 'q',
68 43 => 'r',
69 44 => 's',
70 45 => 't',
71 46 => 'u',
72 47 => 'v',
73 48 => 'w',
74 49 => 'x',
75 50 => 'y',
76 51 => 'z',
77 52 => '0',
78 53 => '1',
79 54 => '2',
80 55 => '3',
81 56 => '4',
82 57 => '5',
83 58 => '6',
84 59 => '7',
85 60 => '8',
86 61 => '9',
87 62 => '+',
88 63 => '/',
89 ];
90
91 /**
92 * @var array
93 */
94 private static $decodingMap = [
95 'A' => 0,
96 'B' => 1,
97 'C' => 2,
98 'D' => 3,
99 'E' => 4,
100 'F' => 5,
101 'G' => 6,
102 'H' => 7,
103 'I' => 8,
104 'J' => 9,
105 'K' => 10,
106 'L' => 11,
107 'M' => 12,
108 'N' => 13,
109 'O' => 14,
110 'P' => 15,
111 'Q' => 16,
112 'R' => 17,
113 'S' => 18,
114 'T' => 19,
115 'U' => 20,
116 'V' => 21,
117 'W' => 22,
118 'X' => 23,
119 'Y' => 24,
120 'Z' => 25,
121 'a' => 26,
122 'b' => 27,
123 'c' => 28,
124 'd' => 29,
125 'e' => 30,
126 'f' => 31,
127 'g' => 32,
128 'h' => 33,
129 'i' => 34,
130 'j' => 35,
131 'k' => 36,
132 'l' => 37,
133 'm' => 38,
134 'n' => 39,
135 'o' => 40,
136 'p' => 41,
137 'q' => 42,
138 'r' => 43,
139 's' => 44,
140 't' => 45,
141 'u' => 46,
142 'v' => 47,
143 'w' => 48,
144 'x' => 49,
145 'y' => 50,
146 'z' => 51,
147 0 => 52,
148 1 => 53,
149 2 => 54,
150 3 => 55,
151 4 => 56,
152 5 => 57,
153 6 => 58,
154 7 => 59,
155 8 => 60,
156 9 => 61,
157 '+' => 62,
158 '/' => 63,
159 ];
160
161 /**
162 * Convert to base64
163 *
164 * @param integer $value
165 *
166 * @return string
167 */
168 public static function encode($value)
169 {
170 return self::$encodingMap[$value];
171 }
172
173 /**
174 * Convert from base64
175 *
176 * @param string $value
177 *
178 * @return integer
179 */
180 public static function decode($value)
181 {
182 return self::$decodingMap[$value];
183 }
184}