@@ -61,17 +61,17 @@ 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 | - for ($i = 160; $i < 256; $i++) { |
|
74 | + for ($i = 160; $i<256; $i++) { |
|
75 | 75 | $this->xml_iso88591_Entities["in"][] = chr($i); |
76 | 76 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
77 | 77 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->buildConversionTable('xml_iso88591_Entities'); |
98 | 98 | break;*/ |
99 | 99 | default: |
100 | - throw new \Exception('Unsupported table: ' . $tableName); |
|
100 | + throw new \Exception('Unsupported table: '.$tableName); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $srcEncoding = PhpXmlRpc::$xmlrpc_internalencoding; |
133 | 133 | } |
134 | 134 | |
135 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
135 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
136 | 136 | switch ($conversion) { |
137 | 137 | case 'ISO-8859-1_': |
138 | 138 | case 'ISO-8859-1_US-ASCII': |
@@ -162,20 +162,20 @@ discard block |
||
162 | 162 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
163 | 163 | $escapedData = ''; |
164 | 164 | // be kind to users creating string xmlrpc values out of different php types |
165 | - $data = (string)$data; |
|
165 | + $data = (string) $data; |
|
166 | 166 | $ns = strlen($data); |
167 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
167 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
168 | 168 | $ch = $data[$nn]; |
169 | 169 | $ii = ord($ch); |
170 | 170 | // 7 bits: 0bbbbbbb (127) |
171 | - if ($ii < 32) { |
|
171 | + if ($ii<32) { |
|
172 | 172 | if ($conversion == 'UTF-8_' || $conversion == 'UTF-8_US-ASCII') { |
173 | 173 | $escapedData .= sprintf('&#%d;', $ii); |
174 | 174 | } else { |
175 | 175 | $escapedData .= $ch; |
176 | 176 | } |
177 | 177 | } |
178 | - else if ($ii < 128) { |
|
178 | + else if ($ii<128) { |
|
179 | 179 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
180 | 180 | switch ($ii) { |
181 | 181 | case 34: |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | } // 11 bits: 110bbbbb 10bbbbbb (2047) |
200 | 200 | elseif ($ii >> 5 == 6) { |
201 | 201 | $b1 = ($ii & 31); |
202 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
203 | - $ii = ($b1 * 64) + $b2; |
|
202 | + $b2 = (ord($data[$nn+1]) & 63); |
|
203 | + $ii = ($b1 * 64)+$b2; |
|
204 | 204 | $escapedData .= sprintf('&#%d;', $ii); |
205 | 205 | $nn += 1; |
206 | 206 | } // 16 bits: 1110bbbb 10bbbbbb 10bbbbbb |
207 | 207 | elseif ($ii >> 4 == 14) { |
208 | 208 | $b1 = ($ii & 15); |
209 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
210 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
211 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
209 | + $b2 = (ord($data[$nn+1]) & 63); |
|
210 | + $b3 = (ord($data[$nn+2]) & 63); |
|
211 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
212 | 212 | $escapedData .= sprintf('&#%d;', $ii); |
213 | 213 | $nn += 2; |
214 | 214 | } // 21 bits: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
215 | 215 | elseif ($ii >> 3 == 30) { |
216 | 216 | $b1 = ($ii & 7); |
217 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
218 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
219 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
220 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
217 | + $b2 = (ord($data[$nn+1]) & 63); |
|
218 | + $b3 = (ord($data[$nn+2]) & 63); |
|
219 | + $b4 = (ord($data[$nn+3]) & 63); |
|
220 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
221 | 221 | $escapedData .= sprintf('&#%d;', $ii); |
222 | 222 | $nn += 3; |
223 | 223 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | default: |
257 | 257 | $escapedData = ''; |
258 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
258 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $escapedData; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | case 'iso88591': |
310 | 310 | return $this->xml_iso88591_Entities; |
311 | 311 | default: |
312 | - throw new \Exception('Unsupported charset: ' . $charset); |
|
312 | + throw new \Exception('Unsupported charset: '.$charset); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | } |
@@ -174,8 +174,7 @@ |
||
174 | 174 | } else { |
175 | 175 | $escapedData .= $ch; |
176 | 176 | } |
177 | - } |
|
178 | - else if ($ii < 128) { |
|
177 | + } else if ($ii < 128) { |
|
179 | 178 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
180 | 179 | switch ($ii) { |
181 | 180 | case 34: |