@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems) |
68 | 68 | { |
69 | 69 | $url = $serviceID . '=' . urlencode($serviceParam); |
70 | - $amp = $encodeAmpersand?'&':'&'; |
|
70 | + $amp = $encodeAmpersand ? '&' : '&'; |
|
71 | 71 | $request = $this->getRequest(); |
72 | 72 | if(is_array($getItems) || $getItems instanceof \Traversable) |
73 | 73 | { |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | switch($request->getUrlFormat()) |
104 | 104 | { |
105 | 105 | case THttpRequestUrlFormat::Path: |
106 | - return $request->getApplicationUrl() . '/' . strtr($url, [$amp => '/','?' => '/','=' => $request->getUrlParamSeparator()]); |
|
106 | + return $request->getApplicationUrl() . '/' . strtr($url, [$amp => '/', '?' => '/', '=' => $request->getUrlParamSeparator()]); |
|
107 | 107 | case THttpRequestUrlFormat::HiddenPath: |
108 | - return rtrim(dirname($request->getApplicationUrl()), '/') . '/' . strtr($url, [$amp => '/','?' => '/','=' => $request->getUrlParamSeparator()]); |
|
108 | + return rtrim(dirname($request->getApplicationUrl()), '/') . '/' . strtr($url, [$amp => '/', '?' => '/', '=' => $request->getUrlParamSeparator()]); |
|
109 | 109 | default: |
110 | 110 | return $request->getApplicationUrl() . '?' . $url; |
111 | 111 | } |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public static function ensureBoolean($value) |
64 | 64 | { |
65 | - if (is_string($value)) |
|
65 | + if(is_string($value)) |
|
66 | 66 | return strcasecmp($value, 'true') == 0 || $value != 0; |
67 | 67 | else |
68 | - return (boolean)$value; |
|
68 | + return (boolean) $value; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function ensureString($value) |
79 | 79 | { |
80 | - if (TJavaScript::isJsLiteral($value)) |
|
80 | + if(TJavaScript::isJsLiteral($value)) |
|
81 | 81 | return $value; |
82 | - if (is_bool($value)) |
|
83 | - return $value?'true':'false'; |
|
82 | + if(is_bool($value)) |
|
83 | + return $value ? 'true' : 'false'; |
|
84 | 84 | else |
85 | - return (string)$value; |
|
85 | + return (string) $value; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public static function ensureInteger($value) |
94 | 94 | { |
95 | - return (integer)$value; |
|
95 | + return (integer) $value; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function ensureFloat($value) |
104 | 104 | { |
105 | - return (float)$value; |
|
105 | + return (float) $value; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | { |
121 | 121 | $value = trim($value); |
122 | 122 | $len = strlen($value); |
123 | - if ($len >= 2 && $value[0] == '(' && $value[$len - 1] == ')') |
|
123 | + if($len >= 2 && $value[0] == '(' && $value[$len - 1] == ')') |
|
124 | 124 | { |
125 | 125 | eval('$array=array' . $value . ';'); |
126 | 126 | return $array; |
127 | 127 | } |
128 | 128 | else |
129 | - return $len > 0?[$value]:[]; |
|
129 | + return $len > 0 ? [$value] : []; |
|
130 | 130 | } |
131 | 131 | else |
132 | - return (array)$value; |
|
132 | + return (array) $value; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public static function ensureObject($value) |
141 | 141 | { |
142 | - return (object)$value; |
|
142 | + return (object) $value; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -190,6 +190,6 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function ensureNullIfEmpty($value) |
192 | 192 | { |
193 | - return empty($value)?null:$value; |
|
193 | + return empty($value) ?null:$value; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | \ No newline at end of file |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | { |
405 | 405 | $class = get_class($this); |
406 | 406 | $classes = [$class]; |
407 | - while($class = get_parent_class($class)){array_unshift($classes, $class);} |
|
407 | + while($class = get_parent_class($class)) {array_unshift($classes, $class); } |
|
408 | 408 | if($lowercase) |
409 | 409 | return array_map('strtolower', $classes); |
410 | 410 | return $classes; |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | if($this->_listeningenabled) |
430 | 430 | return; |
431 | 431 | |
432 | - $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
|
432 | + $fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']); |
|
433 | 433 | |
434 | 434 | foreach($fx as $func) |
435 | - $this->attachEventHandler($func, [$this,$func]); |
|
435 | + $this->attachEventHandler($func, [$this, $func]); |
|
436 | 436 | |
437 | 437 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
438 | - $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
|
438 | + $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']); |
|
439 | 439 | array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
440 | 440 | } |
441 | 441 | |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | if(!$this->_listeningenabled) |
464 | 464 | return; |
465 | 465 | |
466 | - $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
|
466 | + $fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']); |
|
467 | 467 | |
468 | 468 | foreach($fx as $func) |
469 | - $this->detachEventHandler($func, [$this,$func]); |
|
469 | + $this->detachEventHandler($func, [$this, $func]); |
|
470 | 470 | |
471 | 471 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
472 | - $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
|
472 | + $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']); |
|
473 | 473 | array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
474 | 474 | } |
475 | 475 | |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | if(count($args) > 0) |
526 | 526 | if($args[0] && !($args[0] instanceof TJavaScriptString)) |
527 | 527 | $args[0] = new TJavaScriptString($args[0]); |
528 | - return call_user_func_array([$this,$jsmethod], $args); |
|
528 | + return call_user_func_array([$this, $jsmethod], $args); |
|
529 | 529 | } |
530 | 530 | |
531 | - if (($getset == 'set') && method_exists($this, 'getjs' . $propname)) |
|
531 | + if(($getset == 'set') && method_exists($this, 'getjs' . $propname)) |
|
532 | 532 | throw new TInvalidOperationException('component_property_readonly', get_class($this), $method); |
533 | 533 | } |
534 | 534 | |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | $behavior_args = $args; |
545 | 545 | if($behavior instanceof IClassBehavior) |
546 | 546 | array_unshift($behavior_args, $this); |
547 | - $callchain->addCall([$behavior,$method], $behavior_args); |
|
547 | + $callchain->addCall([$behavior, $method], $behavior_args); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | } |
551 | 551 | if($callchain->getCount() > 0) |
552 | - return call_user_func_array([$callchain,'call'], $args); |
|
552 | + return call_user_func_array([$callchain, 'call'], $args); |
|
553 | 553 | } |
554 | 554 | else |
555 | 555 | { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | { |
560 | 560 | if($behavior instanceof IClassBehavior) |
561 | 561 | array_unshift($args, $this); |
562 | - return call_user_func_array([$behavior,$method], $args); |
|
562 | + return call_user_func_array([$behavior, $method], $args); |
|
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
@@ -569,11 +569,11 @@ discard block |
||
569 | 569 | { |
570 | 570 | if($this instanceof IDynamicMethods) |
571 | 571 | return $this->__dycall($method, $args); |
572 | - return isset($args[0])?$args[0]:null; |
|
572 | + return isset($args[0]) ? $args[0] : null; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // don't thrown an exception for __magicMethods() or any other weird methods natively implemented by php |
576 | - if (!method_exists($this, $method)) { |
|
576 | + if(!method_exists($this, $method)) { |
|
577 | 577 | throw new TApplicationException('component_method_undefined', get_class($this), $method); |
578 | 578 | } |
579 | 579 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | elseif(method_exists($this, $jsgetter = 'getjs' . $name)) |
613 | 613 | { |
614 | 614 | // getting a javascript property |
615 | - return (string)$this->$jsgetter(); |
|
615 | + return (string) $this->$jsgetter(); |
|
616 | 616 | } |
617 | 617 | elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) |
618 | 618 | { |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $this->getEventHandlers($name)->remove($handler, $priority); |
1048 | 1048 | return true; |
1049 | 1049 | } |
1050 | - catch(\Exception $e) |
|
1050 | + catch (\Exception $e) |
|
1051 | 1051 | { |
1052 | 1052 | } |
1053 | 1053 | } |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0) |
1168 | 1168 | { |
1169 | 1169 | if($method == '__dycall') |
1170 | - $response = $object->__dycall($name, [$sender,$param,$name]); |
|
1170 | + $response = $object->__dycall($name, [$sender, $param, $name]); |
|
1171 | 1171 | else |
1172 | 1172 | $response = $object->$method($sender, $param, $name); |
1173 | 1173 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0) |
1193 | 1193 | { |
1194 | 1194 | if($method == '__dycall') |
1195 | - $response = $object->__dycall($name, [$sender,$param,$name]); |
|
1195 | + $response = $object->__dycall($name, [$sender, $param, $name]); |
|
1196 | 1196 | else |
1197 | 1197 | $response = $object->$method($sender, $param, $name); |
1198 | 1198 | } |
@@ -1206,10 +1206,10 @@ discard block |
||
1206 | 1206 | $this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response); |
1207 | 1207 | |
1208 | 1208 | if($postfunction) |
1209 | - $response = call_user_func_array($postfunction, [$sender,$param,$this,$response]); |
|
1209 | + $response = call_user_func_array($postfunction, [$sender, $param, $this, $response]); |
|
1210 | 1210 | |
1211 | 1211 | if($responsetype & TEventResults::EVENT_RESULT_ALL) |
1212 | - $responses[] = ['sender' => $sender,'param' => $param,'response' => $response]; |
|
1212 | + $responses[] = ['sender' => $sender, 'param' => $param, 'response' => $response]; |
|
1213 | 1213 | else |
1214 | 1214 | $responses[] = $response; |
1215 | 1215 | |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | throw new \Exception(''); |
1256 | 1256 | return $result; |
1257 | 1257 | } |
1258 | - catch(\Exception $e) |
|
1258 | + catch (\Exception $e) |
|
1259 | 1259 | { |
1260 | 1260 | throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage()); |
1261 | 1261 | } |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | ob_end_clean(); |
1291 | 1291 | return $content; |
1292 | 1292 | } |
1293 | - catch(\Exception $e) |
|
1293 | + catch (\Exception $e) |
|
1294 | 1294 | { |
1295 | 1295 | throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage()); |
1296 | 1296 | } |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | throw new TInvalidOperationException('component_class_behavior_defined', $class, $name); |
1408 | 1408 | $param = new TClassBehaviorEventParameter($class, $name, $behavior, $priority); |
1409 | 1409 | self::$_um[$class] = [$name => $param] + self::$_um[$class]; |
1410 | - $behaviorObject = is_string($behavior)?new $behavior:$behavior; |
|
1410 | + $behaviorObject = is_string($behavior) ? new $behavior : $behavior; |
|
1411 | 1411 | return $behaviorObject->raiseEvent('fxAttachClassBehavior', null, $param); |
1412 | 1412 | } |
1413 | 1413 | |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | $param = self::$_um[$class][$name]; |
1439 | 1439 | $behavior = $param->getBehavior(); |
1440 | 1440 | unset(self::$_um[$class][$name]); |
1441 | - $behaviorObject = is_string($behavior)?new $behavior:$behavior; |
|
1441 | + $behaviorObject = is_string($behavior) ? new $behavior : $behavior; |
|
1442 | 1442 | return $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param); |
1443 | 1443 | } |
1444 | 1444 | |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | */ |
1452 | 1452 | public function asa($behaviorname) |
1453 | 1453 | { |
1454 | - return isset($this->_m[$behaviorname])?$this->_m[$behaviorname]:null; |
|
1454 | + return isset($this->_m[$behaviorname]) ? $this->_m[$behaviorname] : null; |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /** |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | if($this instanceof $class) |
1479 | 1479 | return true; |
1480 | 1480 | if($this->_m !== null && $this->_behaviorsenabled) |
1481 | - foreach($this->_m->toArray() as $behavior){ |
|
1481 | + foreach($this->_m->toArray() as $behavior) { |
|
1482 | 1482 | if(($behavior instanceof IBehavior) && !$behavior->getEnabled()) |
1483 | 1483 | continue; |
1484 | 1484 | |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | if($behavior instanceof TClassBehaviorEventParameter) |
1525 | 1525 | $this->detachBehavior($behavior->getName(), $behavior->getPriority()); |
1526 | 1526 | else |
1527 | - $this->detachBehavior(is_string($behavior)?$behavior:$name); |
|
1527 | + $this->detachBehavior(is_string($behavior) ? $behavior : $name); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | */ |
1679 | 1679 | public function enableBehavior($name) |
1680 | 1680 | { |
1681 | - if($this->_m != null && isset($this->_m[$name])){ |
|
1681 | + if($this->_m != null && isset($this->_m[$name])) { |
|
1682 | 1682 | if($this->_m[$name] instanceof IBehavior) { |
1683 | 1683 | $this->_m[$name]->setEnabled(true); |
1684 | 1684 | $this->dyEnableBehavior($name, $this->_m[$name]); |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | */ |
1707 | 1707 | public function disableBehavior($name) |
1708 | 1708 | { |
1709 | - if($this->_m != null && isset($this->_m[$name])){ |
|
1709 | + if($this->_m != null && isset($this->_m[$name])) { |
|
1710 | 1710 | if($this->_m[$name] instanceof IBehavior) { |
1711 | 1711 | $this->_m[$name]->setEnabled(false); |
1712 | 1712 | $this->dyDisableBehavior($name, $this->_m[$name]); |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | */ |
1725 | 1725 | public function __sleep() |
1726 | 1726 | { |
1727 | - $a = (array)$this; |
|
1727 | + $a = (array) $this; |
|
1728 | 1728 | $a = array_keys($a); |
1729 | 1729 | $exprops = []; |
1730 | 1730 | $this->_getZappableSleepProps($exprops); |
@@ -1743,9 +1743,9 @@ discard block |
||
1743 | 1743 | $exprops[] = "\0Prado\TComponent\0_listeningenabled"; |
1744 | 1744 | if($this->_behaviorsenabled === true) |
1745 | 1745 | $exprops[] = "\0Prado\TComponent\0_behaviorsenabled"; |
1746 | - if ($this->_e === []) |
|
1746 | + if($this->_e === []) |
|
1747 | 1747 | $exprops[] = "\0Prado\TComponent\0_e"; |
1748 | - if ($this->_m === null) |
|
1748 | + if($this->_m === null) |
|
1749 | 1749 | $exprops[] = "\0Prado\TComponent\0_m"; |
1750 | 1750 | } |
1751 | 1751 | } |
1752 | 1752 | \ No newline at end of file |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | static $bSimpleXml; |
159 | 159 | if($bSimpleXml === null) |
160 | - $bSimpleXml = (boolean)function_exists('simplexml_load_string'); |
|
160 | + $bSimpleXml = (boolean) function_exists('simplexml_load_string'); |
|
161 | 161 | |
162 | 162 | if($bSimpleXml) |
163 | 163 | { |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function saveToString() |
208 | 208 | { |
209 | - $version = empty($this->_version)?' version="1.0"':' version="' . $this->_version . '"'; |
|
210 | - $encoding = empty($this->_encoding)?'':' encoding="' . $this->_encoding . '"'; |
|
209 | + $version = empty($this->_version) ? ' version="1.0"' : ' version="' . $this->_version . '"'; |
|
210 | + $encoding = empty($this->_encoding) ? '' : ' encoding="' . $this->_encoding . '"'; |
|
211 | 211 | return "<?xml{$version}{$encoding}?>\n" . $this->toString(0); |
212 | 212 | } |
213 | 213 |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $this->delete($id); |
153 | 153 | else |
154 | 154 | { |
155 | - $data = [$value,$dependency]; |
|
155 | + $data = [$value, $dependency]; |
|
156 | 156 | return $this->setValue($this->generateUniqueKey($id), $data, $expire); |
157 | 157 | } |
158 | 158 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | if(empty($value) && $expire === 0) |
172 | 172 | return false; |
173 | - $data = [$value,$dependency]; |
|
173 | + $data = [$value, $dependency]; |
|
174 | 174 | return $this->addValue($this->generateUniqueKey($id), $data, $expire); |
175 | 175 | } |
176 | 176 |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | foreach($this->_servers as $server) |
165 | 165 | { |
166 | 166 | Prado::trace('Adding server ' . $server['Host'] . ' from serverlist', '\Prado\Caching\TMemCache'); |
167 | - if($this->_cache->addServer($server['Host'],$server['Port'],$server['Persistent'], |
|
167 | + if($this->_cache->addServer($server['Host'], $server['Port'], $server['Persistent'], |
|
168 | 168 | $server['Weight'], $server['Timeout'], $server['RetryInterval']) === false) |
169 | 169 | throw new TConfigurationException('memcache_connection_failed', $server['Host'], $server['Port']); |
170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | throw new TConfigurationException('memcache_serverport_required'); |
200 | 200 | if(!is_numeric($port)) |
201 | 201 | throw new TConfigurationException('memcache_serverport_invalid'); |
202 | - $server = ['Host' => $host,'Port' => $port,'Weight' => 1,'Timeout' => 1800,'RetryInterval' => 15,'Persistent' => true]; |
|
202 | + $server = ['Host' => $host, 'Port' => $port, 'Weight' => 1, 'Timeout' => 1800, 'RetryInterval' => 15, 'Persistent' => true]; |
|
203 | 203 | $checks = [ |
204 | 204 | 'Weight' => 'memcache_serverweight_invalid', |
205 | 205 | 'Timeout' => 'memcache_servertimeout_invalid', |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $this -> getApplication() -> setGlobalState($key, time()); |
207 | 207 | } |
208 | 208 | } |
209 | - catch(\Exception $e) |
|
209 | + catch (\Exception $e) |
|
210 | 210 | { |
211 | 211 | // DB table not exists |
212 | 212 | if($this->_autoCreate) |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | $key = 'TDbCache:' . $this->_cacheTable . ':flushed'; |
251 | 251 | $now = time(); |
252 | - $next = $interval + (integer)$this -> getApplication() -> getGlobalState($key, 0); |
|
252 | + $next = $interval + (integer) $this -> getApplication() -> getGlobalState($key, 0); |
|
253 | 253 | |
254 | 254 | if($force || $next <= $now) |
255 | 255 | { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $command = $this->getDbConnection()->createCommand($sql); |
470 | 470 | return unserialize($command->queryScalar()); |
471 | 471 | } |
472 | - catch(\Exception $e) |
|
472 | + catch (\Exception $e) |
|
473 | 473 | { |
474 | 474 | $this->initializeCache(true); |
475 | 475 | return unserialize($command->queryScalar()); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | protected function addValue($key, $value, $expire) |
504 | 504 | { |
505 | 505 | if(!$this->_cacheInitialized) $this->initializeCache(); |
506 | - $expire = ($expire <= 0)?0:time() + $expire; |
|
506 | + $expire = ($expire <= 0) ? 0 : time() + $expire; |
|
507 | 507 | $sql = "INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)"; |
508 | 508 | try |
509 | 509 | { |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | $command->execute(); |
514 | 514 | return true; |
515 | 515 | } |
516 | - catch(\Exception $e) |
|
516 | + catch (\Exception $e) |
|
517 | 517 | { |
518 | 518 | try |
519 | 519 | { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | $command->execute(); |
522 | 522 | return true; |
523 | 523 | } |
524 | - catch(\Exception $e) |
|
524 | + catch (\Exception $e) |
|
525 | 525 | { |
526 | 526 | return false; |
527 | 527 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $command->execute(); |
545 | 545 | return true; |
546 | 546 | } |
547 | - catch(\Exception $e) |
|
547 | + catch (\Exception $e) |
|
548 | 548 | { |
549 | 549 | $this->initializeCache(true); |
550 | 550 | $command->execute(); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}"); |
565 | 565 | $command->execute(); |
566 | 566 | } |
567 | - catch(\Exception $e) |
|
567 | + catch (\Exception $e) |
|
568 | 568 | { |
569 | 569 | try |
570 | 570 | { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $command->execute(); |
573 | 573 | return true; |
574 | 574 | } |
575 | - catch(\Exception $e) |
|
575 | + catch (\Exception $e) |
|
576 | 576 | { |
577 | 577 | return false; |
578 | 578 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function init($config) |
81 | 81 | { |
82 | - if (!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
82 | + if(!function_exists('curl_version')) throw new TConfigurationException('curl_extension_required'); |
|
83 | 83 | parent::init($config); |
84 | 84 | } |
85 | 85 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | protected function setValue($key, $value, $expire) |
156 | 156 | { |
157 | 157 | $value = ['value' => serialize($value)]; |
158 | - if ($expire > 0) $value['ttl'] = $expire; |
|
158 | + if($expire > 0) $value['ttl'] = $expire; |
|
159 | 159 | $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
160 | 160 | return !property_exists($result, 'errorCode'); |
161 | 161 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | protected function addValue($key, $value, $expire) |
173 | 173 | { |
174 | 174 | $value = ['value' => serialize($value), 'prevExist' => 'false']; |
175 | - if ($expire > 0) $value['ttl'] = $expire; |
|
175 | + if($expire > 0) $value['ttl'] = $expire; |
|
176 | 176 | $result = $this->request('PUT', $this->_dir . '/' . $key, $value); |
177 | 177 | return !property_exists($result, 'errorCode'); |
178 | 178 | } |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * Sets error handler to be Prado::phpErrorHandler |
126 | 126 | */ |
127 | - set_error_handler(['\Prado\PradoBase','phpErrorHandler']); |
|
127 | + set_error_handler(['\Prado\PradoBase', 'phpErrorHandler']); |
|
128 | 128 | /** |
129 | 129 | * Sets shutdown function to be Prado::phpFatalErrorHandler |
130 | 130 | */ |
131 | - register_shutdown_function(['PradoBase','phpFatalErrorHandler']); |
|
131 | + register_shutdown_function(['PradoBase', 'phpFatalErrorHandler']); |
|
132 | 132 | /** |
133 | 133 | * Sets exception handler to be Prado::exceptionHandler |
134 | 134 | */ |
135 | - set_exception_handler(['\Prado\PradoBase','exceptionHandler']); |
|
135 | + set_exception_handler(['\Prado\PradoBase', 'exceptionHandler']); |
|
136 | 136 | /** |
137 | 137 | * Disable php's builtin error reporting to avoid duplicated reports |
138 | 138 | */ |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public static function poweredByPrado($logoType = 0) |
157 | 157 | { |
158 | - $logoName = $logoType == 1?'powered2':'powered'; |
|
158 | + $logoName = $logoType == 1 ? 'powered2' : 'powered'; |
|
159 | 159 | if(self::$_application !== null) |
160 | 160 | { |
161 | 161 | $am = self::$_application->getAssetManager(); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | break; |
323 | 323 | default: |
324 | 324 | $s = '$args[1]'; |
325 | - for($i = 2;$i < $n;++$i) |
|
325 | + for($i = 2; $i < $n; ++$i) |
|
326 | 326 | $s .= ",\$args[$i]"; |
327 | 327 | eval("\$component=new $type($s);"); |
328 | 328 | return $component; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | if(class_exists($namespace, false) || interface_exists($namespace, false)) |
396 | 396 | class_alias($namespace, $className); |
397 | 397 | } |
398 | - catch(\Exception $e) |
|
398 | + catch (\Exception $e) |
|
399 | 399 | { |
400 | 400 | if($checkClassExistence && !class_exists($className, false)) |
401 | 401 | throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage()); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public static function getPathOfAlias($alias) |
449 | 449 | { |
450 | - return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null; |
|
450 | + return isset(self::$_aliases[$alias]) ?self::$_aliases[$alias] : null; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | protected static function getPathAliases() |
@@ -513,25 +513,25 @@ discard block |
||
513 | 513 | if(is_string($item)) |
514 | 514 | { |
515 | 515 | $str = htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES); |
516 | - if (strlen($item) > 70) |
|
516 | + if(strlen($item) > 70) |
|
517 | 517 | echo "'" . substr($str, 0, 70) . "...'"; |
518 | 518 | else |
519 | 519 | echo "'" . $str . "'"; |
520 | 520 | } |
521 | - elseif (is_int($item) || is_float($item)) |
|
521 | + elseif(is_int($item) || is_float($item)) |
|
522 | 522 | echo $item; |
523 | - elseif (is_object($item)) |
|
523 | + elseif(is_object($item)) |
|
524 | 524 | echo get_class($item); |
525 | - elseif (is_array($item)) |
|
525 | + elseif(is_array($item)) |
|
526 | 526 | echo 'array(' . count($item) . ')'; |
527 | - elseif (is_bool($item)) |
|
527 | + elseif(is_bool($item)) |
|
528 | 528 | echo $item ? 'true' : 'false'; |
529 | - elseif ($item === null) |
|
529 | + elseif($item === null) |
|
530 | 530 | echo 'NULL'; |
531 | - elseif (is_resource($item)) |
|
531 | + elseif(is_resource($item)) |
|
532 | 532 | echo get_resource_type($item); |
533 | 533 | $count++; |
534 | - if (count($t['args']) > $count) |
|
534 | + if(count($t['args']) > $count) |
|
535 | 535 | echo ', '; |
536 | 536 | } |
537 | 537 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) |
562 | 562 | { |
563 | 563 | $array = explode(';q=', trim($language)); |
564 | - $languages[trim($array[0])] = isset($array[1])?(float)$array[1]:1.0; |
|
564 | + $languages[trim($array[0])] = isset($array[1]) ? (float) $array[1] : 1.0; |
|
565 | 565 | } |
566 | 566 | arsort($languages); |
567 | 567 | $languages = array_keys($languages); |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | if($app === null || ($config = $app->getTranslationConfiguration()) === null) |
685 | 685 | return strtr($text, $params); |
686 | 686 | |
687 | - if ($catalogue === null) |
|
688 | - $catalogue = isset($config['catalogue'])?$config['catalogue']:'messages'; |
|
687 | + if($catalogue === null) |
|
688 | + $catalogue = isset($config['catalogue']) ? $config['catalogue'] : 'messages'; |
|
689 | 689 | |
690 | 690 | Translation::init($catalogue); |
691 | 691 |