@@ -170,11 +170,9 @@ discard block |
||
170 | 170 | $value = $this->_d[$key]; |
171 | 171 | unset($this->_d[$key]); |
172 | 172 | return $value; |
173 | - } |
|
174 | - else |
|
173 | + } else |
|
175 | 174 | return null; |
176 | - } |
|
177 | - else |
|
175 | + } else |
|
178 | 176 | throw new TInvalidOperationException('map_readonly', get_class($this)); |
179 | 177 | } |
180 | 178 | |
@@ -183,8 +181,9 @@ discard block |
||
183 | 181 | */ |
184 | 182 | public function clear() |
185 | 183 | { |
186 | - foreach(array_keys($this->_d) as $key) |
|
187 | - $this->remove($key); |
|
184 | + foreach(array_keys($this->_d) as $key) { |
|
185 | + $this->remove($key); |
|
186 | + } |
|
188 | 187 | } |
189 | 188 | |
190 | 189 | /** |
@@ -216,10 +215,10 @@ discard block |
||
216 | 215 | { |
217 | 216 | if($this->getCount() > 0) |
218 | 217 | $this->clear(); |
219 | - foreach($data as $key => $value) |
|
220 | - $this->add($key, $value); |
|
221 | - } |
|
222 | - elseif($data !== null) |
|
218 | + foreach($data as $key => $value) { |
|
219 | + $this->add($key, $value); |
|
220 | + } |
|
221 | + } elseif($data !== null) |
|
223 | 222 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
224 | 223 | } |
225 | 224 | |
@@ -233,10 +232,10 @@ discard block |
||
233 | 232 | { |
234 | 233 | if(is_array($data) || $data instanceof Traversable) |
235 | 234 | { |
236 | - foreach($data as $key => $value) |
|
237 | - $this->add($key, $value); |
|
238 | - } |
|
239 | - elseif($data !== null) |
|
235 | + foreach($data as $key => $value) { |
|
236 | + $this->add($key, $value); |
|
237 | + } |
|
238 | + } elseif($data !== null) |
|
240 | 239 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
241 | 240 | } |
242 | 241 |
@@ -54,8 +54,9 @@ |
||
54 | 54 | public function rewind() |
55 | 55 | { |
56 | 56 | $this->_iterator->rewind(); |
57 | - for($i = 0;$i < $this->_startIndex;++$i) |
|
58 | - $this->_iterator->next(); |
|
57 | + for($i = 0;$i < $this->_startIndex;++$i) { |
|
58 | + $this->_iterator->next(); |
|
59 | + } |
|
59 | 60 | $this->_index = 0; |
60 | 61 | } |
61 | 62 |
@@ -186,22 +186,18 @@ discard block |
||
186 | 186 | $this->_currentPageIndex = $pageIndex; |
187 | 187 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
188 | 188 | return $pageIndex; |
189 | - } |
|
190 | - else |
|
189 | + } else |
|
191 | 190 | return false; |
192 | - } |
|
193 | - else |
|
191 | + } else |
|
194 | 192 | return false; |
195 | - } |
|
196 | - else |
|
193 | + } else |
|
197 | 194 | { |
198 | 195 | if($pageIndex >= 0 && $pageIndex < $this->getPageCount()) |
199 | 196 | { |
200 | 197 | $this->_currentPageIndex = $pageIndex; |
201 | 198 | $this->onPageIndexChanged(null); |
202 | 199 | return $pageIndex; |
203 | - } |
|
204 | - else |
|
200 | + } else |
|
205 | 201 | return false; |
206 | 202 | } |
207 | 203 | } |
@@ -253,8 +249,7 @@ discard block |
||
253 | 249 | return (int)(($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
254 | 250 | else |
255 | 251 | return -1; |
256 | - } |
|
257 | - else |
|
252 | + } else |
|
258 | 253 | return (int)((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
259 | 254 | } |
260 | 255 | |
@@ -326,9 +321,10 @@ discard block |
||
326 | 321 | public function indexOf($item) |
327 | 322 | { |
328 | 323 | $c = $this->getCount(); |
329 | - for($i = 0;$i < $c;++$i) |
|
330 | - if($this->itemAt($i) === $item) |
|
324 | + for($i = 0;$i < $c;++$i) { |
|
325 | + if($this->itemAt($i) === $item) |
|
331 | 326 | return $i; |
327 | + } |
|
332 | 328 | return -1; |
333 | 329 | } |
334 | 330 | |
@@ -362,8 +358,9 @@ discard block |
||
362 | 358 | { |
363 | 359 | $c = $this->getCount(); |
364 | 360 | $array = []; |
365 | - for($i = 0;$i < $c;++$i) |
|
366 | - $array[$i] = $this->itemAt($i); |
|
361 | + for($i = 0;$i < $c;++$i) { |
|
362 | + $array[$i] = $this->itemAt($i); |
|
363 | + } |
|
367 | 364 | return $array; |
368 | 365 | } |
369 | 366 | } |
370 | 367 | \ No newline at end of file |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $status = TPropertyValue::ensureInteger($status); |
284 | 284 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
285 | 285 | $this->_reason = self::$HTTP_STATUS_CODES[$status]; |
286 | - }else{ |
|
286 | + } else{ |
|
287 | 287 | if($reason === null || $reason === '') { |
288 | 288 | throw new TInvalidDataValueException("response_status_reason_missing"); |
289 | 289 | } |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | $this->sendHttpHeader(); |
378 | 378 | if(is_array($headers)) |
379 | 379 | { |
380 | - foreach($headers as $h) |
|
381 | - header($h); |
|
382 | - } |
|
383 | - else |
|
380 | + foreach($headers as $h) { |
|
381 | + header($h); |
|
382 | + } |
|
383 | + } else |
|
384 | 384 | { |
385 | 385 | header('Pragma: public'); |
386 | 386 | header('Expires: 0'); |
@@ -505,13 +505,11 @@ discard block |
||
505 | 505 | { |
506 | 506 | $this->_bufferOutput = false; |
507 | 507 | ob_end_flush(); |
508 | - } |
|
509 | - else |
|
508 | + } else |
|
510 | 509 | ob_flush(); |
511 | 510 | flush(); |
512 | 511 | } |
513 | - } |
|
514 | - else |
|
512 | + } else |
|
515 | 513 | flush(); |
516 | 514 | } |
517 | 515 | |
@@ -659,8 +657,7 @@ discard block |
||
659 | 657 | $cookie->getSecure(), |
660 | 658 | $cookie->getHttpOnly() |
661 | 659 | ); |
662 | - } |
|
663 | - else { |
|
660 | + } else { |
|
664 | 661 | setcookie( |
665 | 662 | $cookie->getName(), |
666 | 663 | $cookie->getValue(), |
@@ -174,8 +174,9 @@ discard block |
||
174 | 174 | protected function initPageContext($pageConfig) |
175 | 175 | { |
176 | 176 | $application = $this->getApplication(); |
177 | - foreach($pageConfig->getApplicationConfigurations() as $appConfig) |
|
178 | - $application->applyConfiguration($appConfig); |
|
177 | + foreach($pageConfig->getApplicationConfigurations() as $appConfig) { |
|
178 | + $application->applyConfiguration($appConfig); |
|
179 | + } |
|
179 | 180 | |
180 | 181 | $this->applyConfiguration($pageConfig); |
181 | 182 | } |
@@ -240,8 +241,7 @@ discard block |
||
240 | 241 | $pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), ''); |
241 | 242 | } |
242 | 243 | $pageConfig->loadFromFiles($this->getBasePath()); |
243 | - } |
|
244 | - else |
|
244 | + } else |
|
245 | 245 | { |
246 | 246 | $configCached = true; |
247 | 247 | $currentTimestamp = []; |
@@ -259,8 +259,7 @@ discard block |
||
259 | 259 | $currentTimestamp[0] = $appConfigFile === null?0:@filemtime($appConfigFile); |
260 | 260 | if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0])) |
261 | 261 | $configCached = false; |
262 | - } |
|
263 | - else |
|
262 | + } else |
|
264 | 263 | { |
265 | 264 | $currentTimestamp[$fileName] = @filemtime($fileName); |
266 | 265 | if($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName])) |
@@ -268,8 +267,7 @@ discard block |
||
268 | 267 | } |
269 | 268 | } |
270 | 269 | } |
271 | - } |
|
272 | - else |
|
270 | + } else |
|
273 | 271 | { |
274 | 272 | $configCached = false; |
275 | 273 | $paths = explode('.', $pagePath); |
@@ -502,8 +500,7 @@ discard block |
||
502 | 500 | |
503 | 501 | if(!class_exists($className, false)) |
504 | 502 | $className = $namespacedClassName; |
505 | - } |
|
506 | - else |
|
503 | + } else |
|
507 | 504 | { |
508 | 505 | $className = $this->getBasePageClass(); |
509 | 506 | Prado::using($className); |
@@ -530,8 +527,9 @@ discard block |
||
530 | 527 | */ |
531 | 528 | protected function runPage($page, $properties) |
532 | 529 | { |
533 | - foreach($properties as $name => $value) |
|
534 | - $page->setSubProperty($name, $value); |
|
530 | + foreach($properties as $name => $value) { |
|
531 | + $page->setSubProperty($name, $value); |
|
532 | + } |
|
535 | 533 | $page->run($this->getResponse()->createHtmlWriter()); |
536 | 534 | } |
537 | 535 |
@@ -115,8 +115,9 @@ |
||
115 | 115 | $_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler)); |
116 | 116 | $_apiProvider->setId($providerId); |
117 | 117 | |
118 | - foreach($_properties as $_key => $_value) |
|
119 | - $_apiProvider->setSubProperty($_key, $_value); |
|
118 | + foreach($_properties as $_key => $_value) { |
|
119 | + $_apiProvider->setSubProperty($_key, $_value); |
|
120 | + } |
|
120 | 121 | |
121 | 122 | return $_apiProvider; |
122 | 123 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | { |
78 | 78 | if(is_array($config)) |
79 | 79 | { |
80 | - foreach($config as $id => $feed) |
|
81 | - $this->_feeds[$id] = $feed; |
|
80 | + foreach($config as $id => $feed) { |
|
81 | + $this->_feeds[$id] = $feed; |
|
82 | + } |
|
82 | 83 | } |
83 | - } |
|
84 | - else |
|
84 | + } else |
|
85 | 85 | { |
86 | 86 | foreach($config->getElementsByTagName('feed') as $feed) |
87 | 87 | { |
@@ -122,11 +122,9 @@ discard block |
||
122 | 122 | $properties = isset($feedConfig['properties'])?$feedConfig['properties']:[]; |
123 | 123 | else |
124 | 124 | throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
125 | - } |
|
126 | - else |
|
125 | + } else |
|
127 | 126 | throw new TConfigurationException('jsonservice_class_required', $id); |
128 | - } |
|
129 | - else |
|
127 | + } else |
|
130 | 128 | { |
131 | 129 | $properties = $feedConfig->getAttributes(); |
132 | 130 | if(($class = $properties->remove('class')) !== null) |
@@ -134,22 +132,21 @@ discard block |
||
134 | 132 | $feed = Prado::createComponent($class); |
135 | 133 | if(!($feed instanceof IFeedContentProvider)) |
136 | 134 | throw new TConfigurationException('feedservice_feedtype_invalid', $id); |
137 | - } |
|
138 | - else |
|
135 | + } else |
|
139 | 136 | throw new TConfigurationException('feedservice_class_required', $id); |
140 | 137 | } |
141 | 138 | |
142 | 139 | // init feed properties |
143 | - foreach($properties as $name => $value) |
|
144 | - $feed->setSubproperty($name, $value); |
|
140 | + foreach($properties as $name => $value) { |
|
141 | + $feed->setSubproperty($name, $value); |
|
142 | + } |
|
145 | 143 | $feed->init($feedConfig); |
146 | 144 | |
147 | 145 | $content = $feed->getFeedContent(); |
148 | 146 | //$this->getResponse()->setContentType('application/rss+xml'); |
149 | 147 | $this->getResponse()->setContentType($feed->getContentType()); |
150 | 148 | $this->getResponse()->write($content); |
151 | - } |
|
152 | - else |
|
149 | + } else |
|
153 | 150 | throw new THttpException(404, 'feedservice_feed_unknown', $id); |
154 | 151 | } |
155 | 152 | } |
156 | 153 | \ No newline at end of file |
@@ -126,8 +126,7 @@ discard block |
||
126 | 126 | $dom = new TXmlDocument; |
127 | 127 | $dom->loadFromFile($this->_configFile); |
128 | 128 | $this->loadConfig($dom); |
129 | - } |
|
130 | - else |
|
129 | + } else |
|
131 | 130 | throw new TConfigurationException('soapservice_configfile_invalid', $this->_configFile); |
132 | 131 | } |
133 | 132 | $this->loadConfig($config); |
@@ -149,8 +148,7 @@ discard block |
||
149 | 148 | { |
150 | 149 | $serverID = substr($serverID, 0, $pos); |
151 | 150 | $this->_wsdlRequest = true; |
152 | - } |
|
153 | - else |
|
151 | + } else |
|
154 | 152 | $this->_wsdlRequest = false; |
155 | 153 | $this->_serverID = $serverID; |
156 | 154 | if(!isset($this->_servers[$serverID])) |
@@ -176,8 +174,7 @@ discard block |
||
176 | 174 | $this->_servers[$id] = $properties; |
177 | 175 | } |
178 | 176 | } |
179 | - } |
|
180 | - else |
|
177 | + } else |
|
181 | 178 | { |
182 | 179 | foreach($config->getElementsByTagName('soap') as $serverXML) |
183 | 180 | { |
@@ -261,8 +258,9 @@ discard block |
||
261 | 258 | throw new TConfigurationException('soapservice_server_invalid', $serverClass); |
262 | 259 | $server = new $className; |
263 | 260 | $server->setID($this->_serverID); |
264 | - foreach($properties as $name => $value) |
|
265 | - $server->setSubproperty($name, $value); |
|
261 | + foreach($properties as $name => $value) { |
|
262 | + $server->setSubproperty($name, $value); |
|
263 | + } |
|
266 | 264 | return $server; |
267 | 265 | } |
268 | 266 | |
@@ -284,8 +282,7 @@ discard block |
||
284 | 282 | Prado::trace("Generating WSDL", 'Prado\Web\Services\TSoapService'); |
285 | 283 | $this->getResponse()->clear(); |
286 | 284 | $this->getResponse()->write($server->getWsdl()); |
287 | - } |
|
288 | - else |
|
285 | + } else |
|
289 | 286 | { |
290 | 287 | // provide SOAP service |
291 | 288 | Prado::trace("Handling SOAP request", 'Prado\Web\Services\TSoapService'); |
@@ -81,14 +81,12 @@ discard block |
||
81 | 81 | $server->setClass($providerClass, $this); |
82 | 82 | if($this->_persistent) |
83 | 83 | $server->setPersistence(SOAP_PERSISTENCE_SESSION); |
84 | - } |
|
85 | - else |
|
84 | + } else |
|
86 | 85 | $server = $this->createServer(); |
87 | 86 | try |
88 | 87 | { |
89 | 88 | $server->handle(); |
90 | - } |
|
91 | - catch (\Exception $e) |
|
89 | + } catch (\Exception $e) |
|
92 | 90 | { |
93 | 91 | if($this->getApplication()->getMode() === TApplicationMode::Debug) |
94 | 92 | $this->fault($e->getMessage(), $e->__toString()); |
@@ -172,8 +170,10 @@ discard block |
||
172 | 170 | $options['uri'] = $this->_uri; |
173 | 171 | if(is_string($this->_classMap)) |
174 | 172 | { |
175 | - foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className) |
|
176 | - $options['classmap'][$className] = $className; //complex type uses the class name in the wsdl |
|
173 | + foreach(preg_split('/\s*,\s*/', $this->_classMap) as $className) { |
|
174 | + $options['classmap'][$className] = $className; |
|
175 | + } |
|
176 | + //complex type uses the class name in the wsdl |
|
177 | 177 | } |
178 | 178 | return $options; |
179 | 179 | } |
@@ -200,13 +200,11 @@ discard block |
||
200 | 200 | $wsdl = WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); |
201 | 201 | $cache->set(self::WSDL_CACHE_PREFIX . $providerClass, $wsdl); |
202 | 202 | return $wsdl; |
203 | - } |
|
204 | - else |
|
203 | + } else |
|
205 | 204 | { |
206 | 205 | return WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding()); |
207 | 206 | } |
208 | - } |
|
209 | - else |
|
207 | + } else |
|
210 | 208 | return file_get_contents($this->_wsdlUri); |
211 | 209 | } |
212 | 210 |