@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function buildConversionTable($tableName) |
63 | 63 | { |
64 | - switch($tableName) { |
|
64 | + switch ($tableName) { |
|
65 | 65 | case 'xml_iso88591_Entities': |
66 | 66 | if (count($this->xml_iso88591_Entities['in'])) { |
67 | 67 | return; |
68 | 68 | } |
69 | - for ($i = 0; $i < 32; $i++) { |
|
69 | + for ($i = 0; $i<32; $i++) { |
|
70 | 70 | $this->xml_iso88591_Entities["in"][] = chr($i); |
71 | 71 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
75 | 75 | |
76 | - for ($i = 160; $i < 256; $i++) { |
|
76 | + for ($i = 160; $i<256; $i++) { |
|
77 | 77 | $this->xml_iso88591_Entities["in"][] = chr($i); |
78 | 78 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
79 | 79 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | break;*/ |
102 | 102 | |
103 | 103 | default: |
104 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
104 | + throw new \Exception('Unsupported table: '.$tableName); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $destEncoding = 'US-ASCII'; |
144 | 144 | } |
145 | 145 | |
146 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
146 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
147 | 147 | |
148 | 148 | // list ordered with (expected) most common scenarios first |
149 | 149 | switch ($conversion) { |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
162 | 162 | $escapedData = ''; |
163 | 163 | // be kind to users creating string xmlrpc values out of different php types |
164 | - $data = (string)$data; |
|
164 | + $data = (string) $data; |
|
165 | 165 | $ns = strlen($data); |
166 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
166 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
167 | 167 | $ch = $data[$nn]; |
168 | 168 | $ii = ord($ch); |
169 | 169 | // 7 bits in 1 byte: 0bbbbbbb (127) |
170 | - if ($ii < 32) { |
|
170 | + if ($ii<32) { |
|
171 | 171 | if ($conversion == 'UTF-8_US-ASCII') { |
172 | 172 | $escapedData .= sprintf('&#%d;', $ii); |
173 | 173 | } else { |
174 | 174 | $escapedData .= $ch; |
175 | 175 | } |
176 | 176 | } |
177 | - else if ($ii < 128) { |
|
177 | + else if ($ii<128) { |
|
178 | 178 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
179 | 179 | switch ($ii) { |
180 | 180 | case 34: |
@@ -198,25 +198,25 @@ discard block |
||
198 | 198 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
199 | 199 | elseif ($ii >> 5 == 6) { |
200 | 200 | $b1 = ($ii & 31); |
201 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
202 | - $ii = ($b1 * 64) + $b2; |
|
201 | + $b2 = (ord($data[$nn+1]) & 63); |
|
202 | + $ii = ($b1 * 64)+$b2; |
|
203 | 203 | $escapedData .= sprintf('&#%d;', $ii); |
204 | 204 | $nn += 1; |
205 | 205 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
206 | 206 | elseif ($ii >> 4 == 14) { |
207 | 207 | $b1 = ($ii & 15); |
208 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
209 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
210 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
208 | + $b2 = (ord($data[$nn+1]) & 63); |
|
209 | + $b3 = (ord($data[$nn+2]) & 63); |
|
210 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
211 | 211 | $escapedData .= sprintf('&#%d;', $ii); |
212 | 212 | $nn += 2; |
213 | 213 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
214 | 214 | elseif ($ii >> 3 == 30) { |
215 | 215 | $b1 = ($ii & 7); |
216 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
217 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
218 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
219 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
216 | + $b2 = (ord($data[$nn+1]) & 63); |
|
217 | + $b3 = (ord($data[$nn+2]) & 63); |
|
218 | + $b4 = (ord($data[$nn+3]) & 63); |
|
219 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
220 | 220 | $escapedData .= sprintf('&#%d;', $ii); |
221 | 221 | $nn += 3; |
222 | 222 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | default: |
266 | 266 | $escapedData = ''; |
267 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
267 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return $escapedData; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | case 'iso88591': |
319 | 319 | return $this->xml_iso88591_Entities; |
320 | 320 | default: |
321 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
321 | + throw new \Exception('Unsupported charset: '.$charset); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |