@@ -123,11 +123,9 @@ discard block |
||
123 | 123 | { |
124 | 124 | eval('$array=array'.$value.';'); |
125 | 125 | return $array; |
126 | - } |
|
127 | - else |
|
126 | + } else |
|
128 | 127 | return $len>0?array($value):array(); |
129 | - } |
|
130 | - else |
|
128 | + } else |
|
131 | 129 | return (array)$value; |
132 | 130 | } |
133 | 131 | |
@@ -170,8 +168,7 @@ discard block |
||
170 | 168 | throw new TInvalidDataValueException( |
171 | 169 | 'propertyvalue_enumvalue_invalid',$value, |
172 | 170 | implode(' | ',$types[$enums]->getConstants())); |
173 | - } |
|
174 | - else if(!is_array($enums)) |
|
171 | + } else if(!is_array($enums)) |
|
175 | 172 | { |
176 | 173 | $enums=func_get_args(); |
177 | 174 | array_shift($enums); |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $timing['delta'] = $logs[$i+1][3] - $logs[$i][3]; |
44 | 44 | $timing['total'] = $logs[$i+1][3] - $first; |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | $timing['delta'] = '?'; |
49 | 48 | $timing['total'] = $logs[$i][3] - $first; |
@@ -86,8 +85,7 @@ discard block |
||
86 | 85 | <th>Category</th><th>Message</th><th>Time Spent (s)</th><th>Cumulated Time Spent (s)</th> |
87 | 86 | </tr> |
88 | 87 | EOD; |
89 | - } |
|
90 | - else |
|
88 | + } else |
|
91 | 89 | { |
92 | 90 | $string = <<<EOD |
93 | 91 | <table cellspacing="0" cellpadding="2" border="0" width="100%" style="table-layout:auto"> |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | <td class="cumulatedtime">{$total}</td> |
125 | 123 | </tr> |
126 | 124 | EOD; |
127 | - } |
|
128 | - else |
|
125 | + } else |
|
129 | 126 | { |
130 | 127 | $bgcolor = $info['even'] ? "#fff" : "#eee"; |
131 | 128 | $color = $this->getColorLevel($log[1]); |
@@ -167,8 +164,7 @@ discard block |
||
167 | 164 | { |
168 | 165 | $string .= '<span class="level'.$level.'">'.strtoupper($name)."</span>"; |
169 | 166 | } |
170 | - } |
|
171 | - else |
|
167 | + } else |
|
172 | 168 | { |
173 | 169 | $string .= "<tr><td colspan=\"5\" style=\"text-align:center; background-color:black; border-top: 1px solid #ccc; padding:0.2em;\">"; |
174 | 170 | foreach(self::$_levelValues as $name => $level) |
@@ -86,8 +86,7 @@ discard block |
||
86 | 86 | try |
87 | 87 | { |
88 | 88 | $db->createCommand($sql)->query()->close(); |
89 | - } |
|
90 | - catch(Exception $e) |
|
89 | + } catch(Exception $e) |
|
91 | 90 | { |
92 | 91 | // DB table not exists |
93 | 92 | if($this->_autoCreate) |
@@ -153,8 +152,7 @@ discard block |
||
153 | 152 | return $config->getDbConnection(); |
154 | 153 | else |
155 | 154 | throw new TConfigurationException('dblogroute_connectionid_invalid',$this->_connID); |
156 | - } |
|
157 | - else |
|
155 | + } else |
|
158 | 156 | { |
159 | 157 | $db=new TDbConnection; |
160 | 158 | // default to SQLite3 database |
@@ -72,15 +72,13 @@ discard block |
||
72 | 72 | { |
73 | 73 | $phpConfig = include $this->_configFile; |
74 | 74 | $this->loadConfig($phpConfig); |
75 | - } |
|
76 | - else |
|
75 | + } else |
|
77 | 76 | { |
78 | 77 | $dom=new TXmlDocument; |
79 | 78 | $dom->loadFromFile($this->_configFile); |
80 | 79 | $this->loadConfig($dom); |
81 | 80 | } |
82 | - } |
|
83 | - else |
|
81 | + } else |
|
84 | 82 | throw new TConfigurationException('logrouter_configfile_invalid',$this->_configFile); |
85 | 83 | } |
86 | 84 | $this->loadConfig($config); |
@@ -112,8 +110,7 @@ discard block |
||
112 | 110 | $route->init($route); |
113 | 111 | } |
114 | 112 | } |
115 | - } |
|
116 | - else |
|
113 | + } else |
|
117 | 114 | { |
118 | 115 | foreach($config->getElementsByTagName('route') as $routeConfig) |
119 | 116 | { |
@@ -204,8 +204,7 @@ discard block |
||
204 | 204 | $this -> _createCheck = true; |
205 | 205 | $this -> getApplication() -> setGlobalState($key, time()); |
206 | 206 | } |
207 | - } |
|
208 | - catch(\Exception $e) |
|
207 | + } catch(\Exception $e) |
|
209 | 208 | { |
210 | 209 | // DB table not exists |
211 | 210 | if($this->_autoCreate) |
@@ -228,8 +227,7 @@ discard block |
||
228 | 227 | |
229 | 228 | $this -> _createCheck = true; |
230 | 229 | $this -> getApplication() -> setGlobalState($key, time()); |
231 | - } |
|
232 | - else |
|
230 | + } else |
|
233 | 231 | throw new TConfigurationException('db_cachetable_inexistent',$this->_cacheTable); |
234 | 232 | } |
235 | 233 | $this->_cacheInitialized = true; |
@@ -298,8 +296,7 @@ discard block |
||
298 | 296 | return $config->getDbConnection(); |
299 | 297 | else |
300 | 298 | throw new TConfigurationException('dbcache_connectionid_invalid',$this->_connID); |
301 | - } |
|
302 | - else |
|
299 | + } else |
|
303 | 300 | { |
304 | 301 | $db=new TDbConnection; |
305 | 302 | if($this->_connectionString!=='') |
@@ -309,8 +306,7 @@ discard block |
||
309 | 306 | $db->setUsername($this->_username); |
310 | 307 | if($this->_password!=='') |
311 | 308 | $db->setPassword($this->_password); |
312 | - } |
|
313 | - else |
|
309 | + } else |
|
314 | 310 | { |
315 | 311 | // default to SQLite3 database |
316 | 312 | $dbFile=$this->getApplication()->getRuntimePath().'/sqlite3.cache'; |
@@ -467,8 +463,7 @@ discard block |
||
467 | 463 | $sql='SELECT value FROM '.$this->_cacheTable.' WHERE itemkey=\''.$key.'\' AND (expire=0 OR expire>'.time().') ORDER BY expire DESC'; |
468 | 464 | $command=$this->getDbConnection()->createCommand($sql); |
469 | 465 | return unserialize($command->queryScalar()); |
470 | - } |
|
471 | - catch(\Exception $e) |
|
466 | + } catch(\Exception $e) |
|
472 | 467 | { |
473 | 468 | $this->initializeCache(true); |
474 | 469 | return unserialize($command->queryScalar()); |
@@ -511,16 +506,14 @@ discard block |
||
511 | 506 | $command->bindValue(':value',serialize($value),\PDO::PARAM_LOB); |
512 | 507 | $command->execute(); |
513 | 508 | return true; |
514 | - } |
|
515 | - catch(\Exception $e) |
|
509 | + } catch(\Exception $e) |
|
516 | 510 | { |
517 | 511 | try |
518 | 512 | { |
519 | 513 | $this->initializeCache(true); |
520 | 514 | $command->execute(); |
521 | 515 | return true; |
522 | - } |
|
523 | - catch(\Exception $e) |
|
516 | + } catch(\Exception $e) |
|
524 | 517 | { |
525 | 518 | return false; |
526 | 519 | } |
@@ -542,8 +535,7 @@ discard block |
||
542 | 535 | $command->bindValue(':key',$key,\PDO::PARAM_STR); |
543 | 536 | $command->execute(); |
544 | 537 | return true; |
545 | - } |
|
546 | - catch(\Exception $e) |
|
538 | + } catch(\Exception $e) |
|
547 | 539 | { |
548 | 540 | $this->initializeCache(true); |
549 | 541 | $command->execute(); |
@@ -562,16 +554,14 @@ discard block |
||
562 | 554 | { |
563 | 555 | $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
564 | 556 | $command->execute(); |
565 | - } |
|
566 | - catch(\Exception $e) |
|
557 | + } catch(\Exception $e) |
|
567 | 558 | { |
568 | 559 | try |
569 | 560 | { |
570 | 561 | $this->initializeCache(true); |
571 | 562 | $command->execute(); |
572 | 563 | return true; |
573 | - } |
|
574 | - catch(\Exception $e) |
|
564 | + } catch(\Exception $e) |
|
575 | 565 | { |
576 | 566 | return false; |
577 | 567 | } |
@@ -532,8 +532,7 @@ |
||
532 | 532 | { |
533 | 533 | if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path)) |
534 | 534 | $timestamps=array_merge($this->generateTimestamps($path,$level+1)); |
535 | - } |
|
536 | - else if($this->validateFile($path)) |
|
535 | + } else if($this->validateFile($path)) |
|
537 | 536 | $timestamps[$path]=filemtime($path); |
538 | 537 | } |
539 | 538 | closedir($dir); |
@@ -340,8 +340,7 @@ discard block |
||
340 | 340 | { |
341 | 341 | $configFile=$basePath; |
342 | 342 | $basePath=dirname($configFile); |
343 | - } |
|
344 | - else |
|
343 | + } else |
|
345 | 344 | $configFile=null; |
346 | 345 | |
347 | 346 | // determine runtime path |
@@ -361,8 +360,7 @@ discard block |
||
361 | 360 | } |
362 | 361 | $this->setBasePath($basePath); |
363 | 362 | $this->setRuntimePath($runtimePath); |
364 | - } |
|
365 | - else |
|
363 | + } else |
|
366 | 364 | throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
367 | 365 | |
368 | 366 | } |
@@ -391,8 +389,7 @@ discard block |
||
391 | 389 | $this->$method(); |
392 | 390 | $this->_step++; |
393 | 391 | } |
394 | - } |
|
395 | - catch(\Exception $e) |
|
392 | + } catch(\Exception $e) |
|
396 | 393 | { |
397 | 394 | $this->onError($e); |
398 | 395 | } |
@@ -993,8 +990,7 @@ discard block |
||
993 | 990 | foreach($parameter[1] as $name=>$value) |
994 | 991 | $component->setSubProperty($name,$value); |
995 | 992 | $this->_parameters->add($id,$component); |
996 | - } |
|
997 | - else |
|
993 | + } else |
|
998 | 994 | $this->_parameters->add($id,$parameter); |
999 | 995 | } |
1000 | 996 | |
@@ -1053,8 +1049,7 @@ discard block |
||
1053 | 1049 | $config->loadFromFile($this->_configFile); |
1054 | 1050 | if($this->_cacheFile!==null) |
1055 | 1051 | file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
1056 | - } |
|
1057 | - else |
|
1052 | + } else |
|
1058 | 1053 | $config=unserialize(file_get_contents($this->_cacheFile)); |
1059 | 1054 | |
1060 | 1055 | $this->applyConfiguration($config,false); |
@@ -1099,8 +1094,7 @@ discard block |
||
1099 | 1094 | } |
1100 | 1095 | |
1101 | 1096 | $service->init($configElement); |
1102 | - } |
|
1103 | - else |
|
1097 | + } else |
|
1104 | 1098 | throw new THttpException(500,'application_service_unknown',$serviceID); |
1105 | 1099 | } |
1106 | 1100 |
@@ -549,8 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | if($callchain->getCount()>0) |
551 | 551 | return call_user_func_array(array($callchain,'call'),$args); |
552 | - } |
|
553 | - else |
|
552 | + } else |
|
554 | 553 | { |
555 | 554 | foreach($this->_m->toArray() as $behavior) |
556 | 555 | { |
@@ -607,29 +606,25 @@ discard block |
||
607 | 606 | { |
608 | 607 | // getting a property |
609 | 608 | return $this->$getter(); |
610 | - } |
|
611 | - else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
609 | + } else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
612 | 610 | { |
613 | 611 | // getting a javascript property |
614 | 612 | return (string)$this->$jsgetter(); |
615 | - } |
|
616 | - else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name)) |
|
613 | + } else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name)) |
|
617 | 614 | { |
618 | 615 | // getting an event (handler list) |
619 | 616 | $name=strtolower($name); |
620 | 617 | if(!isset($this->_e[$name])) |
621 | 618 | $this->_e[$name]=new TPriorityList; |
622 | 619 | return $this->_e[$name]; |
623 | - } |
|
624 | - else if(strncasecmp($name,'fx',2)===0) |
|
620 | + } else if(strncasecmp($name,'fx',2)===0) |
|
625 | 621 | { |
626 | 622 | // getting a global event (handler list) |
627 | 623 | $name=strtolower($name); |
628 | 624 | if(!isset(self::$_ue[$name])) |
629 | 625 | self::$_ue[$name]=new TPriorityList; |
630 | 626 | return self::$_ue[$name]; |
631 | - } |
|
632 | - else if($this->_behaviorsenabled) |
|
627 | + } else if($this->_behaviorsenabled) |
|
633 | 628 | { |
634 | 629 | // getting a behavior property/event (handler list) |
635 | 630 | if(isset($this->_m[$name])) |
@@ -669,18 +664,15 @@ discard block |
||
669 | 664 | if(strncasecmp($name,'js',2)===0&&$value&&!($value instanceof TJavaScriptLiteral)) |
670 | 665 | $value = new TJavaScriptLiteral($value); |
671 | 666 | return $this->$setter($value); |
672 | - } |
|
673 | - else if(method_exists($this,$jssetter='setjs'.$name)) |
|
667 | + } else if(method_exists($this,$jssetter='setjs'.$name)) |
|
674 | 668 | { |
675 | 669 | if($value&&!($value instanceof TJavaScriptString)) |
676 | 670 | $value=new TJavaScriptString($value); |
677 | 671 | return $this->$jssetter($value); |
678 | - } |
|
679 | - else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0) |
|
672 | + } else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0) |
|
680 | 673 | { |
681 | 674 | return $this->attachEventHandler($name,$value); |
682 | - } |
|
683 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
675 | + } else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
684 | 676 | { |
685 | 677 | $sets=0; |
686 | 678 | foreach($this->_m->toArray() as $behavior) |
@@ -698,8 +690,7 @@ discard block |
||
698 | 690 | if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name)) |
699 | 691 | { |
700 | 692 | throw new TInvalidOperationException('component_property_readonly',get_class($this),$name); |
701 | - } |
|
702 | - else |
|
693 | + } else |
|
703 | 694 | { |
704 | 695 | throw new TInvalidOperationException('component_property_undefined',get_class($this),$name); |
705 | 696 | } |
@@ -727,13 +718,11 @@ discard block |
||
727 | 718 | { |
728 | 719 | $name=strtolower($name); |
729 | 720 | return isset($this->_e[$name])&&$this->_e[$name]->getCount(); |
730 | - } |
|
731 | - else if(strncasecmp($name,'fx',2)===0) |
|
721 | + } else if(strncasecmp($name,'fx',2)===0) |
|
732 | 722 | { |
733 | 723 | $name=strtolower($name); |
734 | 724 | return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount(); |
735 | - } |
|
736 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
725 | + } else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
737 | 726 | { |
738 | 727 | if(isset($this->_m[$name])) |
739 | 728 | return true; |
@@ -743,8 +732,7 @@ discard block |
||
743 | 732 | return isset($behavior->$name); |
744 | 733 | } |
745 | 734 | |
746 | - } |
|
747 | - else |
|
735 | + } else |
|
748 | 736 | return false; |
749 | 737 | } |
750 | 738 | |
@@ -958,15 +946,13 @@ discard block |
||
958 | 946 | if(!isset($this->_e[$name])) |
959 | 947 | $this->_e[$name]=new TPriorityList; |
960 | 948 | return $this->_e[$name]; |
961 | - } |
|
962 | - else if(strncasecmp($name,'fx',2)===0) |
|
949 | + } else if(strncasecmp($name,'fx',2)===0) |
|
963 | 950 | { |
964 | 951 | $name=strtolower($name); |
965 | 952 | if(!isset(self::$_ue[$name])) |
966 | 953 | self::$_ue[$name]=new TPriorityList; |
967 | 954 | return self::$_ue[$name]; |
968 | - } |
|
969 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
955 | + } else if($this->_m!==null&&$this->_behaviorsenabled) |
|
970 | 956 | { |
971 | 957 | foreach($this->_m->toArray() as $behavior) |
972 | 958 | { |
@@ -1045,8 +1031,7 @@ discard block |
||
1045 | 1031 | { |
1046 | 1032 | $this->getEventHandlers($name)->remove($handler,$priority); |
1047 | 1033 | return true; |
1048 | - } |
|
1049 | - catch(\Exception $e) |
|
1034 | + } catch(\Exception $e) |
|
1050 | 1035 | { |
1051 | 1036 | } |
1052 | 1037 | } |
@@ -1169,14 +1154,11 @@ discard block |
||
1169 | 1154 | $response=$object->__dycall($name,array($sender,$param,$name)); |
1170 | 1155 | else |
1171 | 1156 | $response=$object->$method($sender,$param,$name); |
1172 | - } |
|
1173 | - else |
|
1157 | + } else |
|
1174 | 1158 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler); |
1175 | - } |
|
1176 | - else |
|
1159 | + } else |
|
1177 | 1160 | $response=call_user_func($handler,$sender,$param,$name); |
1178 | - } |
|
1179 | - else if(is_callable($handler,true)) |
|
1161 | + } else if(is_callable($handler,true)) |
|
1180 | 1162 | { |
1181 | 1163 | list($object,$method)=$handler; |
1182 | 1164 | if(is_string($object)) |
@@ -1194,12 +1176,10 @@ discard block |
||
1194 | 1176 | $response=$object->__dycall($name,array($sender,$param,$name)); |
1195 | 1177 | else |
1196 | 1178 | $response=$object->$method($sender,$param,$name); |
1197 | - } |
|
1198 | - else |
|
1179 | + } else |
|
1199 | 1180 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler[1]); |
1200 | 1181 | } |
1201 | - } |
|
1202 | - else |
|
1182 | + } else |
|
1203 | 1183 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,gettype($handler)); |
1204 | 1184 | |
1205 | 1185 | $this->dyIntraRaiseEventPostHandler($name,$sender,$param,$handler,$response); |
@@ -1216,8 +1196,7 @@ discard block |
||
1216 | 1196 | $param=$response; |
1217 | 1197 | |
1218 | 1198 | } |
1219 | - } |
|
1220 | - else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name)) |
|
1199 | + } else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name)) |
|
1221 | 1200 | throw new TInvalidOperationException('component_event_undefined',get_class($this),$name); |
1222 | 1201 | |
1223 | 1202 | if($responsetype&TEventResults::EVENT_RESULT_FILTER) |
@@ -1253,8 +1232,7 @@ discard block |
||
1253 | 1232 | if(eval("\$result=$expression;")===false) |
1254 | 1233 | throw new \Exception(''); |
1255 | 1234 | return $result; |
1256 | - } |
|
1257 | - catch(\Exception $e) |
|
1235 | + } catch(\Exception $e) |
|
1258 | 1236 | { |
1259 | 1237 | throw new TInvalidOperationException('component_expression_invalid',get_class($this),$expression,$e->getMessage()); |
1260 | 1238 | } |
@@ -1288,8 +1266,7 @@ discard block |
||
1288 | 1266 | $content=ob_get_contents(); |
1289 | 1267 | ob_end_clean(); |
1290 | 1268 | return $content; |
1291 | - } |
|
1292 | - catch(\Exception $e) |
|
1269 | + } catch(\Exception $e) |
|
1293 | 1270 | { |
1294 | 1271 | throw new TInvalidOperationException('component_statements_invalid',get_class($this),$statements,$e->getMessage()); |
1295 | 1272 | } |
@@ -232,8 +232,7 @@ discard block |
||
232 | 232 | $port=$_SERVER['SERVER_PORT']; |
233 | 233 | if(($port!=80 && !$secure) || ($port!=443 && $secure)) |
234 | 234 | $url.=':'.$port; |
235 | - } |
|
236 | - else |
|
235 | + } else |
|
237 | 236 | $url.=$_SERVER['HTTP_HOST']; |
238 | 237 | $url.=$this->getRequestUri(); |
239 | 238 | $this->_url=new TUri($url); |
@@ -341,8 +340,7 @@ discard block |
||
341 | 340 | { |
342 | 341 | $this->_urlManager=new TUrlManager; |
343 | 342 | $this->_urlManager->init(null); |
344 | - } |
|
345 | - else |
|
343 | + } else |
|
346 | 344 | { |
347 | 345 | $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); |
348 | 346 | if($this->_urlManager===null) |
@@ -462,8 +460,7 @@ discard block |
||
462 | 460 | |
463 | 461 | if($result === null && function_exists('apache_request_headers')) { |
464 | 462 | $result = apache_request_headers(); |
465 | - } |
|
466 | - elseif($result === null) { |
|
463 | + } elseif($result === null) { |
|
467 | 464 | $result = array(); |
468 | 465 | foreach($_SERVER as $key=>$value) { |
469 | 466 | if(strncasecmp($key, 'HTTP_', 5) !== 0) continue; |
@@ -566,8 +563,7 @@ discard block |
||
566 | 563 | try |
567 | 564 | { |
568 | 565 | return get_browser(); |
569 | - } |
|
570 | - catch(TPhpErrorException $e) |
|
566 | + } catch(TPhpErrorException $e) |
|
571 | 567 | { |
572 | 568 | throw new TConfigurationException('httprequest_browscap_required'); |
573 | 569 | } |
@@ -670,8 +666,7 @@ discard block |
||
670 | 666 | if(($value=$sm->validateData($value))!==false) |
671 | 667 | $this->_cookies->add(new THttpCookie($key,$value)); |
672 | 668 | } |
673 | - } |
|
674 | - else |
|
669 | + } else |
|
675 | 670 | { |
676 | 671 | foreach($_COOKIE as $key=>$value) |
677 | 672 | $this->_cookies->add(new THttpCookie($key,$value)); |
@@ -888,8 +883,7 @@ discard block |
||
888 | 883 | $value=$this->_items[$key]; |
889 | 884 | unset($this->_items[$key]); |
890 | 885 | return $value; |
891 | - } |
|
892 | - else |
|
886 | + } else |
|
893 | 887 | return null; |
894 | 888 | } |
895 | 889 |