@@ -186,15 +186,13 @@ discard block |
||
186 | 186 | $formatInfo = $culture->NumberFormat; |
187 | 187 | $formatInfo->setPattern($type); |
188 | 188 | return $formatInfo; |
189 | - } |
|
190 | - elseif(is_string($culture)) |
|
189 | + } elseif(is_string($culture)) |
|
191 | 190 | { |
192 | 191 | $cultureInfo = new CultureInfo($culture); |
193 | 192 | $formatInfo = $cultureInfo->NumberFormat; |
194 | 193 | $formatInfo->setPattern($type); |
195 | 194 | return $formatInfo; |
196 | - } |
|
197 | - else |
|
195 | + } else |
|
198 | 196 | { |
199 | 197 | $cultureInfo = new CultureInfo(); |
200 | 198 | $formatInfo = $cultureInfo->NumberFormat; |
@@ -294,8 +292,7 @@ discard block |
||
294 | 292 | { |
295 | 293 | $groupSize1 = $decimalPos - $groupPos1 - 1; |
296 | 294 | |
297 | - } |
|
298 | - else |
|
295 | + } else |
|
299 | 296 | { |
300 | 297 | //no decimal point, so traverse from the back |
301 | 298 | //to find the groupsize 1. |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public static function getInstance($culture = null, |
182 | 182 | $type = NumberFormatInfo::DECIMAL) |
183 | 183 | { |
184 | - if ($culture instanceof CultureInfo) |
|
184 | + if($culture instanceof CultureInfo) |
|
185 | 185 | { |
186 | 186 | $formatInfo = $culture->NumberFormat; |
187 | 187 | $formatInfo->setPattern($type); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $groupPos2 = false; |
263 | 263 | $groupSize1 = false; |
264 | 264 | $groupSize2 = false; |
265 | - $decimalPoints = is_int($decimalPos)?-1:false; |
|
265 | + $decimalPoints = is_int($decimalPos) ?-1 : false; |
|
266 | 266 | |
267 | 267 | $info['negPref'] = $this->data['NumberElements'][6]; |
268 | 268 | $info['negPost'] = ''; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | { |
354 | 354 | $regexp = '/[#,\.0]+/'; |
355 | 355 | $result = preg_split($regexp, $pattern); |
356 | - return [$result[0],$result[1]]; |
|
356 | + return [$result[0], $result[1]]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 |
@@ -80,8 +80,7 @@ |
||
80 | 80 | // i-prefix, such as i-cherokee |
81 | 81 | if(count($codes) > 1) |
82 | 82 | $lang = $codes[1]; |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | { |
86 | 85 | for($i = 0, $k = count($codes); $i < $k; ++$i) |
87 | 86 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | $this->languages = []; |
59 | 59 | |
60 | - if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
60 | + if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
|
61 | 61 | return $this->languages; |
62 | 62 | |
63 | 63 | //$basedir = CultureInfo::dataDir(); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) |
68 | 68 | { |
69 | 69 | // Cut off any q-value that might come after a semi-colon |
70 | - if ($pos = strpos($lang, ';')) |
|
70 | + if($pos = strpos($lang, ';')) |
|
71 | 71 | $lang = trim(substr($lang, 0, $pos)); |
72 | 72 | |
73 | - if (strstr($lang, '-')) |
|
73 | + if(strstr($lang, '-')) |
|
74 | 74 | { |
75 | 75 | $codes = explode('-', $lang); |
76 | 76 | if($codes[0] == 'i') |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | $this->charsets = []; |
116 | 116 | |
117 | - if (!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
117 | + if(!isset($_SERVER['HTTP_ACCEPT_CHARSET'])) |
|
118 | 118 | return $this->charsets; |
119 | 119 | |
120 | - foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
120 | + foreach(explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) |
|
121 | 121 | { |
122 | - if (!empty($charset)) |
|
122 | + if(!empty($charset)) |
|
123 | 123 | $this->charsets[] = preg_replace('/;.*/', '', $charset); |
124 | 124 | } |
125 | 125 |
@@ -87,8 +87,7 @@ discard block |
||
87 | 87 | try |
88 | 88 | { |
89 | 89 | $db->createCommand($sql)->query()->close(); |
90 | - } |
|
91 | - catch(Exception $e) |
|
90 | + } catch(Exception $e) |
|
92 | 91 | { |
93 | 92 | // DB table not exists |
94 | 93 | if($this->_autoCreate) |
@@ -154,8 +153,7 @@ discard block |
||
154 | 153 | return $config->getDbConnection(); |
155 | 154 | else |
156 | 155 | throw new TConfigurationException('dblogroute_connectionid_invalid', $this->_connID); |
157 | - } |
|
158 | - else |
|
156 | + } else |
|
159 | 157 | { |
160 | 158 | $db = new TDbConnection; |
161 | 159 | // default to SQLite3 database |
@@ -88,7 +88,7 @@ |
||
88 | 88 | { |
89 | 89 | $db->createCommand($sql)->query()->close(); |
90 | 90 | } |
91 | - catch(Exception $e) |
|
91 | + catch (Exception $e) |
|
92 | 92 | { |
93 | 93 | // DB table not exists |
94 | 94 | if($this->_autoCreate) |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $timing['delta'] = $logs[$i + 1][3] - $logs[$i][3]; |
45 | 45 | $timing['total'] = $logs[$i + 1][3] - $first; |
46 | - } |
|
47 | - else |
|
46 | + } else |
|
48 | 47 | { |
49 | 48 | $timing['delta'] = '?'; |
50 | 49 | $timing['total'] = $logs[$i][3] - $first; |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | <th>Category</th><th>Message</th><th>Time Spent (s)</th><th>Cumulated Time Spent (s)</th> |
88 | 87 | </tr> |
89 | 88 | EOD; |
90 | - } |
|
91 | - else |
|
89 | + } else |
|
92 | 90 | { |
93 | 91 | $string = <<<EOD |
94 | 92 | <table cellspacing="0" cellpadding="2" border="0" width="100%" style="table-layout:auto"> |
@@ -125,8 +123,7 @@ discard block |
||
125 | 123 | <td class="cumulatedtime">{$total}</td> |
126 | 124 | </tr> |
127 | 125 | EOD; |
128 | - } |
|
129 | - else |
|
126 | + } else |
|
130 | 127 | { |
131 | 128 | $bgcolor = $info['even'] ? "#fff" : "#eee"; |
132 | 129 | $color = $this->getColorLevel($log[1]); |
@@ -168,8 +165,7 @@ discard block |
||
168 | 165 | { |
169 | 166 | $string .= '<span class="level' . $level . '">' . strtoupper($name) . "</span>"; |
170 | 167 | } |
171 | - } |
|
172 | - else |
|
168 | + } else |
|
173 | 169 | { |
174 | 170 | $string .= "<tr><td colspan=\"5\" style=\"text-align:center; background-color:black; border-top: 1px solid #ccc; padding:0.2em;\">"; |
175 | 171 | foreach(self::$_levelValues as $name => $level) |
@@ -37,9 +37,9 @@ |
||
37 | 37 | $even = true; |
38 | 38 | $response = $this->getApplication()->getResponse(); |
39 | 39 | $response->write($this->renderHeader()); |
40 | - for($i = 0,$n = count($logs);$i < $n;++$i) |
|
40 | + for($i = 0, $n = count($logs); $i < $n; ++$i) |
|
41 | 41 | { |
42 | - if ($i < $n - 1) |
|
42 | + if($i < $n - 1) |
|
43 | 43 | { |
44 | 44 | $timing['delta'] = $logs[$i + 1][3] - $logs[$i][3]; |
45 | 45 | $timing['total'] = $logs[$i + 1][3] - $first; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | <th> </th> |
87 | 87 | <th>Category</th><th>Message</th><th>Time Spent (s)</th><th>Cumulated Time Spent (s)</th> |
88 | 88 | </tr> |
89 | -EOD; |
|
89 | +eod; |
|
90 | 90 | } |
91 | 91 | else |
92 | 92 | { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | <th style="width: 15px"> </th> |
101 | 101 | <th style="width: auto">Category</th><th style="width: auto">Message</th><th style="width: 120px">Time Spent (s)</th><th style="width: 150px">Cumulated Time Spent (s)</th> |
102 | 102 | </tr> |
103 | -EOD; |
|
103 | +eod; |
|
104 | 104 | } |
105 | 105 | return $string; |
106 | 106 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <td class="time">{$delta}</td> |
125 | 125 | <td class="cumulatedtime">{$total}</td> |
126 | 126 | </tr> |
127 | -EOD; |
|
127 | +eod; |
|
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | <td style="text-align:center">{$delta}</td> |
139 | 139 | <td style="text-align:center">{$total}</td> |
140 | 140 | </tr> |
141 | -EOD; |
|
141 | +eod; |
|
142 | 142 | } |
143 | 143 | return $string; |
144 | 144 | } |
@@ -233,8 +233,7 @@ discard block |
||
233 | 233 | $year = "{$date['year']}"; |
234 | 234 | $month = $date['mon']; |
235 | 235 | $day = $date['mday']; |
236 | - } |
|
237 | - else |
|
236 | + } else |
|
238 | 237 | { |
239 | 238 | $year = null; |
240 | 239 | $month = null; |
@@ -270,8 +269,7 @@ discard block |
||
270 | 269 | $year = $iYear + 2000; |
271 | 270 | } |
272 | 271 | $year = (int)$year; |
273 | - } |
|
274 | - elseif($token == 'MM' || $token == 'M') |
|
272 | + } elseif($token == 'MM' || $token == 'M') |
|
275 | 273 | { |
276 | 274 | $month = $this->getInteger($value,$i_val, |
277 | 275 | $this->length($token), 2); |
@@ -281,8 +279,7 @@ discard block |
||
281 | 279 | //throw new TInvalidDataValueException('Invalid month', $value); |
282 | 280 | $i_val += strlen($month); |
283 | 281 | $month = $iMonth; |
284 | - } |
|
285 | - elseif ($token == 'dd' || $token == 'd') |
|
282 | + } elseif ($token == 'dd' || $token == 'd') |
|
286 | 283 | { |
287 | 284 | $day = $this->getInteger($value,$i_val, |
288 | 285 | $this->length($token), 2); |
@@ -292,8 +289,7 @@ discard block |
||
292 | 289 | //throw new TInvalidDataValueException('Invalid day', $value); |
293 | 290 | $i_val += strlen($day); |
294 | 291 | $day = $iDay; |
295 | - } |
|
296 | - else |
|
292 | + } else |
|
297 | 293 | { |
298 | 294 | if($this->substring($value, $i_val, $this->length($token)) != $token) |
299 | 295 | return null; |
@@ -241,21 +241,21 @@ discard block |
||
241 | 241 | $day = null; |
242 | 242 | } |
243 | 243 | |
244 | - while ($i_format < $pattern_length) |
|
244 | + while($i_format < $pattern_length) |
|
245 | 245 | { |
246 | 246 | $c = $this->charAt($pattern, $i_format); |
247 | 247 | $token = ''; |
248 | - while ($this->charEqual($pattern, $i_format, $c) |
|
248 | + while($this->charEqual($pattern, $i_format, $c) |
|
249 | 249 | && ($i_format < $pattern_length)) |
250 | 250 | { |
251 | 251 | $token .= $this->charAt($pattern, $i_format++); |
252 | 252 | } |
253 | 253 | |
254 | - if ($token == 'yyyy' || $token == 'yy' || $token == 'y') |
|
254 | + if($token == 'yyyy' || $token == 'yy' || $token == 'y') |
|
255 | 255 | { |
256 | - if ($token == 'yyyy') { $x = 4;$y = 4; } |
|
257 | - if ($token == 'yy') { $x = 2;$y = 2; } |
|
258 | - if ($token == 'y') { $x = 2;$y = 4; } |
|
256 | + if($token == 'yyyy') { $x = 4; $y = 4; } |
|
257 | + if($token == 'yy') { $x = 2; $y = 2; } |
|
258 | + if($token == 'y') { $x = 2; $y = 4; } |
|
259 | 259 | $year = $this->getInteger($value, $i_val, $x, $y); |
260 | 260 | if($year === null) |
261 | 261 | return null; |
@@ -263,30 +263,30 @@ discard block |
||
263 | 263 | $i_val += strlen($year); |
264 | 264 | if(strlen($year) == 2) |
265 | 265 | { |
266 | - $iYear = (int)$year; |
|
266 | + $iYear = (int) $year; |
|
267 | 267 | if($iYear > 70) |
268 | 268 | $year = $iYear + 1900; |
269 | 269 | else |
270 | 270 | $year = $iYear + 2000; |
271 | 271 | } |
272 | - $year = (int)$year; |
|
272 | + $year = (int) $year; |
|
273 | 273 | } |
274 | 274 | elseif($token == 'MM' || $token == 'M') |
275 | 275 | { |
276 | - $month = $this->getInteger($value,$i_val, |
|
276 | + $month = $this->getInteger($value, $i_val, |
|
277 | 277 | $this->length($token), 2); |
278 | - $iMonth = (int)$month; |
|
278 | + $iMonth = (int) $month; |
|
279 | 279 | if($month === null || $iMonth < 1 || $iMonth > 12) |
280 | 280 | return null; |
281 | 281 | //throw new TInvalidDataValueException('Invalid month', $value); |
282 | 282 | $i_val += strlen($month); |
283 | 283 | $month = $iMonth; |
284 | 284 | } |
285 | - elseif ($token == 'dd' || $token == 'd') |
|
285 | + elseif($token == 'dd' || $token == 'd') |
|
286 | 286 | { |
287 | - $day = $this->getInteger($value,$i_val, |
|
287 | + $day = $this->getInteger($value, $i_val, |
|
288 | 288 | $this->length($token), 2); |
289 | - $iDay = (int)$day; |
|
289 | + $iDay = (int) $day; |
|
290 | 290 | if($day === null || $iDay < 1 || $iDay > 31) |
291 | 291 | return null; |
292 | 292 | //throw new TInvalidDataValueException('Invalid day', $value); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $i_val += $this->length($token); |
303 | 303 | } |
304 | 304 | } |
305 | - if ($i_val != $this->length($value)) |
|
305 | + if($i_val != $this->length($value)) |
|
306 | 306 | return null; |
307 | 307 | //throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value); |
308 | 308 | if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null)) |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | if(empty($year)) { |
313 | 313 | $year = date('Y'); |
314 | 314 | } |
315 | - $day = (int)$day <= 0 ? 1 : (int)$day; |
|
316 | - $month = (int)$month <= 0 ? 1 : (int)$month; |
|
315 | + $day = (int) $day <= 0 ? 1 : (int) $day; |
|
316 | + $month = (int) $month <= 0 ? 1 : (int) $month; |
|
317 | 317 | |
318 | 318 | $s = new \DateTime; |
319 | 319 | $s->setDate($year, $month, $day); |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | private function getInteger($str, $i, $minlength, $maxlength) |
367 | 367 | { |
368 | 368 | //match for digits backwards |
369 | - for ($x = $maxlength; $x >= $minlength; $x--) |
|
369 | + for($x = $maxlength; $x >= $minlength; $x--) |
|
370 | 370 | { |
371 | 371 | $token = $this->substring($str, $i, $x); |
372 | - if ($this->length($token) < $minlength) |
|
372 | + if($this->length($token) < $minlength) |
|
373 | 373 | return null; |
374 | - if (preg_match('/^\d+$/', $token)) |
|
374 | + if(preg_match('/^\d+$/', $token)) |
|
375 | 375 | return $token; |
376 | 376 | } |
377 | 377 | return null; |
@@ -68,8 +68,7 @@ |
||
68 | 68 | { |
69 | 69 | $delta = $logs[$i + 1][3] - $logs[$i][3]; |
70 | 70 | $total = $logs[$i + 1][3] - $first; |
71 | - } |
|
72 | - else |
|
71 | + } else |
|
73 | 72 | { |
74 | 73 | $delta = '?'; |
75 | 74 | $total = $logs[$i][3] - $first; |
@@ -58,13 +58,13 @@ |
||
58 | 58 | |
59 | 59 | $first = $logs[0][3]; |
60 | 60 | $c = count($logs); |
61 | - for($i = 0,$n = $c;$i < $n;++$i) |
|
61 | + for($i = 0, $n = $c; $i < $n; ++$i) |
|
62 | 62 | { |
63 | 63 | $message = $logs[$i][0]; |
64 | 64 | $level = $logs[$i][1]; |
65 | 65 | $category = $logs[$i][2]; |
66 | 66 | |
67 | - if ($i < $n - 1) |
|
67 | + if($i < $n - 1) |
|
68 | 68 | { |
69 | 69 | $delta = $logs[$i + 1][3] - $logs[$i][3]; |
70 | 70 | $total = $logs[$i + 1][3] - $first; |
@@ -52,8 +52,7 @@ |
||
52 | 52 | { |
53 | 53 | $result = highlight_string("<?php\n" . self::$_output, true); |
54 | 54 | return preg_replace('/<\\?php<br \\/>/', '', $result, 1); |
55 | - } |
|
56 | - else |
|
55 | + } else |
|
57 | 56 | return self::$_output; |
58 | 57 | } |
59 | 58 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | switch(gettype($var)) |
63 | 63 | { |
64 | 64 | case 'boolean': |
65 | - self::$_output .= $var?'true':'false'; |
|
65 | + self::$_output .= $var ? 'true' : 'false'; |
|
66 | 66 | break; |
67 | 67 | case 'integer': |
68 | 68 | self::$_output .= "$var"; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $id = array_push(self::$_objects, $var); |
111 | 111 | $className = get_class($var); |
112 | - $members = (array)$var; |
|
112 | + $members = (array) $var; |
|
113 | 113 | $keys = array_keys($members); |
114 | 114 | $spaces = str_repeat(' ', $level * 4); |
115 | 115 | self::$_output .= "$className#$id\n" . $spaces . '('; |
@@ -150,8 +150,7 @@ |
||
150 | 150 | { |
151 | 151 | $info['NumericPrecision'] = intval($ps[0]); |
152 | 152 | $info['NumericScale'] = intval($ps[1]); |
153 | - } |
|
154 | - else |
|
153 | + } else |
|
155 | 154 | $info['ColumnSize'] = intval($match[1]); |
156 | 155 | $info['DbType'] = substr($type, 0, $pos); |
157 | 156 | } |
@@ -68,8 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $this->_connection->getPdoInstance()->commit(); |
70 | 70 | $this->_active = false; |
71 | - } |
|
72 | - else |
|
71 | + } else |
|
73 | 72 | throw new TDbException('dbtransaction_transaction_inactive'); |
74 | 73 | } |
75 | 74 | |
@@ -83,8 +82,7 @@ discard block |
||
83 | 82 | { |
84 | 83 | $this->_connection->getPdoInstance()->rollBack(); |
85 | 84 | $this->_active = false; |
86 | - } |
|
87 | - else |
|
85 | + } else |
|
88 | 86 | throw new TDbException('dbtransaction_transaction_inactive'); |
89 | 87 | } |
90 | 88 |