Passed
Push — php-cs-fixer ( b9836a...b7e6c1 )
by Fabio
30:46 queued 14:47
created
framework/Web/UI/ActiveControls/TActiveTableRow.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function bubbleEvent($sender, $param)
119 119
 	{
120
-		if ($param instanceof TActiveTableCellEventParameter)
120
+		if($param instanceof TActiveTableCellEventParameter)
121 121
 		{
122 122
 			$this->raiseCallbackEvent($param);
123 123
 			return true;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		parent::addAttributesToRender($writer);
149 149
 		$writer->addAttribute('id', $this->getClientID());
150
-		if ($this->hasEventHandler('OnRowSelected'))
150
+		if($this->hasEventHandler('OnRowSelected'))
151 151
 			$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
152 152
 	}
153 153
 
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function render($writer)
162 162
 	{
163
-		if ($this->getHasPreRendered())
163
+		if($this->getHasPreRendered())
164 164
 		{
165 165
 			parent::render($writer);
166
-			if ($this->getActiveControl()->canUpdateClientSide())
166
+			if($this->getActiveControl()->canUpdateClientSide())
167 167
 				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
168 168
 		}
169 169
 		else
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
172 172
 			// If we update a TActiveTableRow on callback, we shouldn't update all childs,
173 173
 			// because the whole content will be replaced by the parent.
174
-			if ($this->getHasControls())
174
+			if($this->getHasControls())
175 175
 			{
176
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
176
+				foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
177 177
 					$control->getActiveControl()->setEnableUpdate(false);
178 178
 			}
179 179
 		}
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function getRowIndex()
201 201
 	{
202
-		foreach ($this->getTable()->getRows() as $key => $row)
203
-			if ($row == $this) return $key;
202
+		foreach($this->getTable()->getRows() as $key => $row)
203
+			if($row == $this) return $key;
204 204
 		throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID());
205 205
 	}
206 206
 
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function getTable()
213 213
 	{
214
-		if ($this->_table === null)
214
+		if($this->_table === null)
215 215
 		{
216 216
 			$table = $this->getParent();
217
-			while (!($table instanceof TTable) && $table !== null)
217
+			while(!($table instanceof TTable) && $table !== null)
218 218
 			{
219 219
 				$table = $table->getParent();
220 220
 			}
221
-			if ($table instanceof TTable) $this->_table = $table;
221
+			if($table instanceof TTable) $this->_table = $table;
222 222
 			else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID());
223 223
 		}
224 224
 		return $this->_table;
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 		{
122 122
 			$this->raiseCallbackEvent($param);
123 123
 			return true;
124
-		}
125
-		else return false;
124
+		} else return false;
126 125
 	}
127 126
 
128 127
 	/**
@@ -165,16 +164,16 @@  discard block
 block discarded – undo
165 164
 			parent::render($writer);
166 165
 			if ($this->getActiveControl()->canUpdateClientSide())
167 166
 				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
168
-		}
169
-		else
167
+		} else
170 168
 		{
171 169
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
172 170
 			// If we update a TActiveTableRow on callback, we shouldn't update all childs,
173 171
 			// because the whole content will be replaced by the parent.
174 172
 			if ($this->getHasControls())
175 173
 			{
176
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
177
-					$control->getActiveControl()->setEnableUpdate(false);
174
+				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) {
175
+									$control->getActiveControl()->setEnableUpdate(false);
176
+				}
178 177
 			}
179 178
 		}
180 179
 	}
@@ -199,8 +198,9 @@  discard block
 block discarded – undo
199 198
 	 */
200 199
 	public function getRowIndex()
201 200
 	{
202
-		foreach ($this->getTable()->getRows() as $key => $row)
203
-			if ($row == $this) return $key;
201
+		foreach ($this->getTable()->getRows() as $key => $row) {
202
+					if ($row == $this) return $key;
203
+		}
204 204
 		throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID());
205 205
 	}
206 206
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveFileUpload.php 2 patches
Braces   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -239,13 +239,11 @@  discard block
 block discarded – undo
239 239
 				// this is the most secure method, file info can't be forged from client side, no matter what
240 240
 				$token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000));
241 241
 				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242
-			}
243
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
242
+			} elseif ($mgr = Prado::getApplication()->getSecurityManager())
244 243
 			{
245 244
 				// this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key
246 245
 				$token = urlencode(base64_encode($mgr->encrypt(serialize($params))));
247
-			}
248
-		else
246
+			} else
249 247
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
250 248
 
251 249
 		return $token;
@@ -259,13 +257,11 @@  discard block
 block discarded – undo
259 257
 				assert($v != '');
260 258
 				$cache->delete($token); // remove it from cache so it can't be used again and won't take up space either
261 259
 				$params = unserialize($v);
262
-			}
263
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
260
+			} elseif ($mgr = Prado::getApplication()->getSecurityManager())
264 261
 			{
265 262
 				$v = $mgr->decrypt(base64_decode(urldecode($token)));
266 263
 				$params = unserialize($v);
267
-			}
268
-		else
264
+			} else
269 265
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
270 266
 
271 267
 		assert($params instanceof TActiveFileUploadCallbackParams);
@@ -346,10 +342,11 @@  discard block
 block discarded – undo
346 342
 	public function onUnload($param){
347 343
 		if ($this->getPage()->getIsCallback())
348 344
 		{
349
-		  foreach($this->getFiles() as $file)
350
-			if($file->getHasFile() && file_exists($file->getLocalName())){
345
+		  foreach($this->getFiles() as $file) {
346
+		  			if($file->getHasFile() && file_exists($file->getLocalName())){
351 347
 			  unlink($file->getLocalName());
352 348
 		  }
349
+		  }
353 350
 		}
354 351
 		parent::onUnload($param);
355 352
 	}
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * TActiveControlAdapter. If you override this class, be sure to set the
90 90
 	 * adapter appropriately by, for example, by calling this constructor.
91 91
 	 */
92
-	public function __construct(){
92
+	public function __construct() {
93 93
 		parent::__construct();
94 94
 		$this->setAdapter(new TActiveControlAdapter($this));
95 95
 	}
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function onFileUpload($param)
116 116
 	{
117
-		if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){
117
+		if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()) {
118 118
 		  $params = new TActiveFileUploadCallbackParams;
119 119
 		  // save the files so that they will persist past the end of this return.
120
-		  foreach ($this->getFiles() as $file) {
120
+		  foreach($this->getFiles() as $file) {
121 121
 			  $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
122 122
 			  $file->saveAs($localName);
123 123
 			  $file->setLocalName($localName);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
           	 Options = new Object();
130 130
           	 Options.clientID = '{$this->getClientID()}';
131 131
           	 Options.targetID = '{$this->_target->getUniqueID()}';
132
-          	 Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
132
+          	 Options.errorCode = '" . (int) !$this->getHasAllFiles() . "';
133 133
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
134 134
           	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
135 135
              Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return string the path where the uploaded file will be stored temporarily, in namespace format
147 147
 	 * default "Application.runtime.*"
148 148
 	 */
149
-	public function getTempPath(){
149
+	public function getTempPath() {
150 150
 		return $this->getViewState('TempPath', 'Application.runtime.*');
151 151
 	}
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string the path where the uploaded file will be stored temporarily in namespace format
155 155
 	 * default "Application.runtime.*"
156 156
 	 */
157
-	public function setTempPath($value){
157
+	public function setTempPath($value) {
158 158
 		$this->setViewState('TempPath', $value, 'Application.runtime.*');
159 159
 	}
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
163 163
 	 * Note: When set to false, you will need to trigger the callback yourself.
164 164
 	 */
165
-	public function getAutoPostBack(){
165
+	public function getAutoPostBack() {
166 166
 		return $this->getViewState('AutoPostBack', true);
167 167
 	}
168 168
 
@@ -170,28 +170,28 @@  discard block
 block discarded – undo
170 170
 	 * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
171 171
 	 * Note: When set to false, you will need to trigger the callback yourself.
172 172
 	 */
173
-	public function setAutoPostBack($value){
173
+	public function setAutoPostBack($value) {
174 174
 		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true);
175 175
 	}
176 176
 
177 177
 	/**
178 178
 	 * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false}
179 179
 	 */
180
-	public function getCallbackJavascript(){
180
+	public function getCallbackJavascript() {
181 181
 		return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")";
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable.
186 186
 	 */
187
-	public function onInit($sender){
187
+	public function onInit($sender) {
188 188
 		parent::onInit($sender);
189 189
 
190
-		if (!Prado::getApplication()->getCache())
191
-		  if (!Prado::getApplication()->getSecurityManager())
190
+		if(!Prado::getApplication()->getCache())
191
+		  if(!Prado::getApplication()->getSecurityManager())
192 192
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
193 193
 
194
-		if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){
194
+		if(!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) {
195 195
 			throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath());
196 196
 		}
197 197
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	 * This method is mainly used by framework and control developers.
204 204
 	 * @param TCallbackEventParameter $param the event parameter
205 205
 	 */
206
-	public function raiseCallbackEvent($param){
206
+	public function raiseCallbackEvent($param) {
207 207
 		$cp = $param->getCallbackParameter();
208
-		if ($key = $cp->targetID == $this->_target->getUniqueID()){
208
+		if($key = $cp->targetID == $this->_target->getUniqueID()) {
209 209
 
210 210
 			$params = $this->popParamsByToken($cp->callbackToken);
211 211
 	  foreach($params->files as $index => $file)
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 
235 235
 	protected function pushParamsAndGetToken(TActiveFileUploadCallbackParams $params)
236 236
 	{
237
-		if ($cache = Prado::getApplication()->getCache())
237
+		if($cache = Prado::getApplication()->getCache())
238 238
 			{
239 239
 				// this is the most secure method, file info can't be forged from client side, no matter what
240 240
 				$token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000));
241 241
 				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242 242
 			}
243
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
243
+		elseif($mgr = Prado::getApplication()->getSecurityManager())
244 244
 			{
245 245
 				// this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key
246 246
 				$token = urlencode(base64_encode($mgr->encrypt(serialize($params))));
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
 
254 254
 	protected function popParamsByToken($token)
255 255
 	{
256
-		if ($cache = Prado::getApplication()->getCache())
256
+		if($cache = Prado::getApplication()->getCache())
257 257
 			{
258 258
 				$v = $cache->get($token);
259 259
 				assert($v != '');
260 260
 				$cache->delete($token); // remove it from cache so it can't be used again and won't take up space either
261 261
 				$params = unserialize($v);
262 262
 			}
263
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
263
+		elseif($mgr = Prado::getApplication()->getSecurityManager())
264 264
 			{
265 265
 				$v = $mgr->decrypt(base64_decode(urldecode($token)));
266 266
 				$params = unserialize($v);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
284 284
 		{
285 285
 		  $params = new TActiveFileUploadCallbackParams;
286
-		  foreach ($this->getFiles() as $file) {
286
+		  foreach($this->getFiles() as $file) {
287 287
 			$localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), ''));
288 288
 			$file->setLocalName($localName);
289 289
 			// tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
           	 Options = new Object();
296 296
           	 Options.clientID = '{$_GET['TActiveFileUpload_InputId']}';
297 297
           	 Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}';
298
-			       Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
298
+			       Options.errorCode = '" . (int) !$this->getHasAllFiles() . "';
299 299
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
300 300
           	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
301 301
              Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * Removes localfile on ending of the callback.
345 345
 	 */
346
-	public function onUnload($param){
347
-		if ($this->getPage()->getIsCallback())
346
+	public function onUnload($param) {
347
+		if($this->getPage()->getIsCallback())
348 348
 		{
349 349
 		  foreach($this->getFiles() as $file)
350
-			if($file->getHasFile() && file_exists($file->getLocalName())){
350
+			if($file->getHasFile() && file_exists($file->getLocalName())) {
351 351
 			  unlink($file->getLocalName());
352 352
 		  }
353 353
 		}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	/**
358 358
 	 * @return TBaseActiveCallbackControl standard callback control options.
359 359
 	 */
360
-	public function getActiveControl(){
360
+	public function getActiveControl() {
361 361
 		return $this->getAdapter()->getBaseActiveControl();
362 362
 	}
363 363
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * Adds ID attribute, and renders the javascript for active component.
374 374
 	 * @param THtmlWriter $writer the writer used for the rendering purpose
375 375
 	 */
376
-	public function addAttributesToRender($writer){
376
+	public function addAttributesToRender($writer) {
377 377
 		parent::addAttributesToRender($writer);
378 378
 		$writer->addAttribute('id', $this->getClientID());
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * @return string corresponding javascript class name for this control.
385 385
 	 */
386
-	protected function getClientClassName(){
386
+	protected function getClientClassName() {
387 387
 		return 'Prado.WebUI.TActiveFileUpload';
388 388
 	}
389 389
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 * 					completeID => complete client ID,
398 398
 	 * 					errorID => error client ID)
399 399
 	 */
400
-	protected function getClientOptions(){
400
+	protected function getClientOptions() {
401 401
 		$options['ID'] = $this->getClientID();
402 402
 		$options['EventTarget'] = $this->getUniqueID();
403 403
 
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	 * If true, you will not be able to save the uploaded file again.
420 420
 	 * @return boolean true if the file saving is successful
421 421
 	 */
422
-	public function saveAs($fileName, $deleteTempFile = true, $index = 0){
423
-		if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){
424
-			if ($deleteTempFile)
422
+	public function saveAs($fileName, $deleteTempFile = true, $index = 0) {
423
+		if(($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) {
424
+			if($deleteTempFile)
425 425
 				return rename($this->getLocalName($index), $fileName);
426 426
 			else
427 427
 				return copy($this->getLocalName($index), $fileName);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @return TImage the image displayed when an upload
434 434
 	 * 		completes successfully.
435 435
 	 */
436
-	public function getSuccessImage(){
436
+	public function getSuccessImage() {
437 437
 		$this->ensureChildControls();
438 438
 		return $this->_success;
439 439
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 * @return TImage the image displayed when an upload
443 443
 	 * 		does not complete successfully.
444 444
 	 */
445
-	public function getErrorImage(){
445
+	public function getErrorImage() {
446 446
 		$this->ensureChildControls();
447 447
 		return $this->_error;
448 448
 	}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 * @return TImage the image displayed when an upload
452 452
 	 * 		is in progress.
453 453
 	 */
454
-	public function getBusyImage(){
454
+	public function getBusyImage() {
455 455
 		$this->ensureChildControls();
456 456
 		return $this->_busy;
457 457
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveTableCell.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	{
130 130
 		parent::addAttributesToRender($writer);
131 131
 		$writer->addAttribute('id', $this->getClientID());
132
-		if ($this->hasEventHandler('OnCellSelected'))
132
+		if($this->hasEventHandler('OnCellSelected'))
133 133
 			$this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
134 134
 	}
135 135
 
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function render($writer)
144 144
 	{
145
-		if ($this->getHasPreRendered())
145
+		if($this->getHasPreRendered())
146 146
 		{
147 147
 			parent::render($writer);
148
-			if ($this->getActiveControl()->canUpdateClientSide())
148
+			if($this->getActiveControl()->canUpdateClientSide())
149 149
 				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
150 150
 		}
151 151
 		else {
152 152
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
153 153
 			// If we update a TActiveTableCell on callback, we shouldn't update all childs,
154 154
 			// because the whole content will be replaced by the parent.
155
-			if ($this->getHasControls())
155
+			if($this->getHasControls())
156 156
 			{
157
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
157
+				foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
158 158
 					$control->getActiveControl()->setEnableUpdate(false);
159 159
 			}
160 160
 		}
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function getCellIndex()
182 182
 	{
183
-		foreach ($this->getRow()->getCells() as $key => $row)
184
-			if ($row == $this) return $key;
183
+		foreach($this->getRow()->getCells() as $key => $row)
184
+			if($row == $this) return $key;
185 185
 		throw new TConfigurationException('tactivetablecell_control_notincollection', get_class($this), $this->getUniqueID());
186 186
 	}
187 187
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function getRow()
194 194
 	{
195
-		if ($this->_row === null)
195
+		if($this->_row === null)
196 196
 		{
197 197
 			$row = $this->getParent();
198
-			while (!($row instanceof TTableRow) && $row !== null)
198
+			while(!($row instanceof TTableRow) && $row !== null)
199 199
 			{
200 200
 				$row = $row->getParent();
201 201
 			}
202
-			if ($row instanceof TTableRow) $this->_row = $row;
202
+			if($row instanceof TTableRow) $this->_row = $row;
203 203
 			else throw new TConfigurationException('tactivetablecell_control_outoftable', get_class($this), $this->getUniqueID());
204 204
 		}
205 205
 		return $this->_row;
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
 			parent::render($writer);
148 148
 			if ($this->getActiveControl()->canUpdateClientSide())
149 149
 				$this->getPage()->getCallbackClient()->replaceContent($this, $writer);
150
-		}
151
-		else {
150
+		} else {
152 151
 			$this->getPage()->getAdapter()->registerControlToRender($this, $writer);
153 152
 			// If we update a TActiveTableCell on callback, we shouldn't update all childs,
154 153
 			// because the whole content will be replaced by the parent.
155 154
 			if ($this->getHasControls())
156 155
 			{
157
-				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control)
158
-					$control->getActiveControl()->setEnableUpdate(false);
156
+				foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) {
157
+									$control->getActiveControl()->setEnableUpdate(false);
158
+				}
159 159
 			}
160 160
 		}
161 161
 	}
@@ -180,8 +180,9 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function getCellIndex()
182 182
 	{
183
-		foreach ($this->getRow()->getCells() as $key => $row)
184
-			if ($row == $this) return $key;
183
+		foreach ($this->getRow()->getCells() as $key => $row) {
184
+					if ($row == $this) return $key;
185
+		}
185 186
 		throw new TConfigurationException('tactivetablecell_control_notincollection', get_class($this), $this->getUniqueID());
186 187
 	}
187 188
 
Please login to merge, or discard this patch.
framework/Web/UI/TCompositeLiteral.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function evaluateDynamicContent()
81 81
 	{
82
-		$context = $this->_container === null?$this:$this->_container;
82
+		$context = $this->_container === null ? $this : $this->_container;
83 83
 		foreach($this->_expressions as $id => $expression)
84 84
 			$this->_items[$id] = $context->evaluateExpression($expression);
85 85
 		foreach($this->_statements as $id => $statement)
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function dataBind()
94 94
 	{
95
-		$context = $this->_container === null?$this:$this->_container;
95
+		$context = $this->_container === null ? $this : $this->_container;
96 96
 		foreach($this->_bindings as $id => $binding)
97 97
 			$this->_items[$id] = $context->evaluateExpression($binding);
98 98
 	}
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
 				elseif($item[0] === self::TYPE_DATABINDING)
53 53
 					$this->_bindings[$id] = $item[1];
54 54
 				$this->_items[$id] = '';
55
-			}
56
-			else
55
+			} else
57 56
 				$this->_items[$id] = $item;
58 57
 		}
59 58
 	}
@@ -80,10 +79,12 @@  discard block
 block discarded – undo
80 79
 	public function evaluateDynamicContent()
81 80
 	{
82 81
 		$context = $this->_container === null?$this:$this->_container;
83
-		foreach($this->_expressions as $id => $expression)
84
-			$this->_items[$id] = $context->evaluateExpression($expression);
85
-		foreach($this->_statements as $id => $statement)
86
-			$this->_items[$id] = $context->evaluateStatements($statement);
82
+		foreach($this->_expressions as $id => $expression) {
83
+					$this->_items[$id] = $context->evaluateExpression($expression);
84
+		}
85
+		foreach($this->_statements as $id => $statement) {
86
+					$this->_items[$id] = $context->evaluateStatements($statement);
87
+		}
87 88
 	}
88 89
 
89 90
 	/**
@@ -93,8 +94,9 @@  discard block
 block discarded – undo
93 94
 	public function dataBind()
94 95
 	{
95 96
 		$context = $this->_container === null?$this:$this->_container;
96
-		foreach($this->_bindings as $id => $binding)
97
-			$this->_items[$id] = $context->evaluateExpression($binding);
97
+		foreach($this->_bindings as $id => $binding) {
98
+					$this->_items[$id] = $context->evaluateExpression($binding);
99
+		}
98 100
 	}
99 101
 
100 102
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiDialog.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,9 +108,10 @@  discard block
 block discarded – undo
108 108
 		if(!isset($options['appendTo']))
109 109
 			$options['appendTo'] = 'form:first';
110 110
 
111
-		foreach($this->getControls() as $control)
112
-			if($control instanceof TJuiDialogButton)
111
+		foreach($this->getControls() as $control) {
112
+					if($control instanceof TJuiDialogButton)
113 113
 				$options['buttons'][] = $control->getPostBackOptions();
114
+		}
114 115
 
115 116
 		return $options;
116 117
 	}
@@ -193,8 +194,7 @@  discard block
 block discarded – undo
193 194
 		{
194 195
 		  parent::renderContents($writer);
195 196
 			$this->getPage()->getCallbackClient()->replaceContent($this, $writer, false);
196
-		}
197
-		else
197
+		} else
198 198
 			parent::render($writer);
199 199
 	}
200 200
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function getOptions()
74 74
 	{
75
-		if (($options = $this->getViewState('JuiOptions')) === null)
75
+		if(($options = $this->getViewState('JuiOptions')) === null)
76 76
 		{
77 77
 		  $options = new TJuiControlOptions($this);
78 78
 		  $this->setViewState('JuiOptions', $options);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * Raises the OnCreate event
145 145
 	 * @param object $params event parameters
146 146
 	 */
147
-	public function onOpen ($params)
147
+	public function onOpen($params)
148 148
 	{
149 149
 		$this->raiseEvent('OnOpen', $this, $params);
150 150
 	}
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiControlOptions.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,9 +141,10 @@
 block discarded – undo
141 141
 	{
142 142
 		$ret = ($this->_options === null) ? [] : $this->_options;
143 143
 
144
-		foreach($this->_control->getValidEvents() as $event)
145
-			if($this->_control->hasEventHandler('on' . $event))
144
+		foreach($this->_control->getValidEvents() as $event) {
145
+					if($this->_control->hasEventHandler('on' . $event))
146 146
 				$ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(" . TJavaScript::encode($this->_control->getUniqueID()) . ", " . TJavaScript::encode($event) . ", event, ui, this); }");
147
+		}
147 148
 
148 149
 		return $ret;
149 150
 	}
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiCallbackPageStateTracker.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
41 41
 	 */
42 42
   protected function updateJuiOptions($options)
43 43
   {
44
-	foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value));
44
+	foreach ($options as $key => $value) {
45
+		$options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value));
46
+	}
45 47
 	$code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });";
46 48
 	$this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code);
47 49
   }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 	 */
42 42
   protected function updateJuiOptions($options)
43 43
   {
44
-	foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value));
44
+	foreach($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value));
45 45
 	$code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });";
46 46
 	$this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code);
47 47
   }
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiEventParameter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 	{
55 55
 		$control = null;
56 56
 		$service = Prado::getApplication()->getService();
57
-		if ($service instanceof TPageService)
57
+		if($service instanceof TPageService)
58 58
 		{
59 59
 			// Find the control
60 60
 			// Warning, this will not work if you have a '_' in your control Id !
Please login to merge, or discard this patch.
framework/Web/UI/TTemplate.php 2 patches
Braces   +36 added lines, -60 removed lines patch added patch discarded remove patch
@@ -233,8 +233,9 @@  discard block
 block discarded – undo
233 233
 					$component->trackViewState(false);
234 234
 
235 235
 					$component->applyStyleSheetSkin($page);
236
-					foreach($properties as $name => $value)
237
-						$this->configureControl($component, $name, $value);
236
+					foreach($properties as $name => $value) {
237
+											$this->configureControl($component, $name, $value);
238
+					}
238 239
 
239 240
 					$component->trackViewState(true);
240 241
 
@@ -244,8 +245,7 @@  discard block
 block discarded – undo
244 245
 						$component->createdOnTemplate($parent);
245 246
 					if($component->getAllowChildControls())
246 247
 						$controls[$key] = $component;
247
-				}
248
-				elseif($component instanceof TComponent)
248
+				} elseif($component instanceof TComponent)
249 249
 				{
250 250
 					$controls[$key] = $component;
251 251
 					if(isset($properties['id']))
@@ -256,15 +256,15 @@  discard block
 block discarded – undo
256 256
 						if(!$component->hasProperty('id'))
257 257
 							unset($properties['id']);
258 258
 					}
259
-					foreach($properties as $name => $value)
260
-						$this->configureComponent($component, $name, $value);
259
+					foreach($properties as $name => $value) {
260
+											$this->configureComponent($component, $name, $value);
261
+					}
261 262
 					if($parent === $parentControl)
262 263
 						$directChildren[] = $component;
263 264
 					else
264 265
 						$component->createdOnTemplate($parent);
265 266
 				}
266
-			}
267
-			else
267
+			} else
268 268
 			{
269 269
 				if($object[1] instanceof TCompositeLiteral)
270 270
 				{
@@ -275,8 +275,7 @@  discard block
 block discarded – undo
275 275
 						$directChildren[] = $o;
276 276
 					else
277 277
 						$parent->addParsedObject($o);
278
-				}
279
-				else
278
+				} else
280 279
 				{
281 280
 					if($parent === $parentControl)
282 281
 						$directChildren[] = $object[1];
@@ -387,8 +386,7 @@  discard block
 block discarded – undo
387 386
 					throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
388 387
 					break;
389 388
 			}
390
-		}
391
-		else
389
+		} else
392 390
 		{
393 391
 			if (substr($name, 0, 2) == 'js')
394 392
 				if ($value and !($value instanceof TJavaScriptLiteral))
@@ -436,8 +434,7 @@  discard block
 block discarded – undo
436 434
 					throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
437 435
 					break;
438 436
 			}
439
-		}
440
-		else
437
+		} else
441 438
 			$component->setSubProperty($name, $value);
442 439
 	}
443 440
 
@@ -498,8 +495,7 @@  discard block
 block discarded – undo
498 495
 						$stack[] = $type;
499 496
 						$container = $c - 1;
500 497
 					}
501
-				}
502
-				elseif(strpos($str, '</com:') === 0)	// closing component tag
498
+				} elseif(strpos($str, '</com:') === 0)	// closing component tag
503 499
 				{
504 500
 					if($expectPropEnd)
505 501
 						continue;
@@ -518,8 +514,7 @@  discard block
 block discarded – undo
518 514
 						throw new TConfigurationException('template_closingtag_expected', $tag, "</com:$type>");
519 515
 					}
520 516
 					$container = $tpl[$container][0];
521
-				}
522
-				elseif(strpos($str, '<%@') === 0)	// directive
517
+				} elseif(strpos($str, '<%@') === 0)	// directive
523 518
 				{
524 519
 					if($expectPropEnd)
525 520
 						continue;
@@ -529,8 +524,7 @@  discard block
 block discarded – undo
529 524
 					if(isset($tpl[0]) || $this->_directive !== null)
530 525
 						throw new TConfigurationException('template_directive_nonunique');
531 526
 					$this->_directive = $this->parseAttributes($match[4][0], $match[4][1]);
532
-				}
533
-				elseif(strpos($str, '<%') === 0)	// expression
527
+				} elseif(strpos($str, '<%') === 0)	// expression
534 528
 				{
535 529
 					if($expectPropEnd)
536 530
 						continue;
@@ -555,8 +549,7 @@  discard block
 block discarded – undo
555 549
 						$literal = strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'","\\" => "\\\\"]);
556 550
 						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"]];
557 551
 					}
558
-				}
559
-				elseif(strpos($str, '<prop:') === 0)	// opening property
552
+				} elseif(strpos($str, '<prop:') === 0)	// opening property
560 553
 				{
561 554
 					if(strrpos($str, '/>') === strlen($str) - 2)  //subproperties
562 555
 					{
@@ -568,8 +561,9 @@  discard block
 block discarded – undo
568 561
 						$prop = strtolower($match[6][0]);
569 562
 						$attrs = $this->parseAttributes($match[7][0], $match[7][1]);
570 563
 						$attributes = [];
571
-						foreach($attrs as $name => $value)
572
-							$attributes[$prop . '.' . $name] = $value;
564
+						foreach($attrs as $name => $value) {
565
+													$attributes[$prop . '.' . $name] = $value;
566
+						}
573 567
 						$type = $tpl[$container][1];
574 568
 						$this->validateAttributes($type, $attributes);
575 569
 						foreach($attributes as $name => $value)
@@ -578,8 +572,7 @@  discard block
 block discarded – undo
578 572
 								throw new TConfigurationException('template_property_duplicated', $name);
579 573
 							$tpl[$container][2][$name] = $value;
580 574
 						}
581
-					}
582
-					else  // regular property
575
+					} else  // regular property
583 576
 					{
584 577
 						$prop = strtolower($match[3][0]);
585 578
 						$stack[] = '@' . $prop;
@@ -591,8 +584,7 @@  discard block
 block discarded – undo
591 584
 							$expectPropEnd = true;
592 585
 						}
593 586
 					}
594
-				}
595
-				elseif(strpos($str, '</prop:') === 0)	// closing property
587
+				} elseif(strpos($str, '</prop:') === 0)	// closing property
596 588
 				{
597 589
 					$prop = strtolower($match[3][0]);
598 590
 					if(empty($stack))
@@ -619,23 +611,20 @@  discard block
 block discarded – undo
619 611
 								if(isset($tpl[$container][2][$prop]))
620 612
 									throw new TConfigurationException('template_property_duplicated', $prop);
621 613
 								$tpl[$container][2][$prop] = $value;
622
-							}
623
-							else	// a property for the template control
614
+							} else	// a property for the template control
624 615
 								$this->_directive[$prop] = $value;
625 616
 							$textStart = $matchEnd + 1;
626 617
 						}
627 618
 						$expectPropEnd = false;
628 619
 					}
629
-				}
630
-				elseif(strpos($str, '<!--') === 0)	// comments
620
+				} elseif(strpos($str, '<!--') === 0)	// comments
631 621
 				{
632 622
 					if($expectPropEnd)
633 623
 						throw new TConfigurationException('template_comments_forbidden');
634 624
 					if($matchStart > $textStart)
635 625
 						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
636 626
 					$textStart = $matchEnd + 1;
637
-				}
638
-				else
627
+				} else
639 628
 					throw new TConfigurationException('template_matching_unexpected', $match);
640 629
 			}
641 630
 			if(!empty($stack))
@@ -646,8 +635,7 @@  discard block
 block discarded – undo
646 635
 			}
647 636
 			if($textStart < strlen($input))
648 637
 				$tpl[$c++] = [$container,substr($input, $textStart)];
649
-		}
650
-		catch(\Exception $e)
638
+		} catch(\Exception $e)
651 639
 		{
652 640
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
653 641
 				throw $e;
@@ -680,14 +668,12 @@  discard block
 block discarded – undo
680 668
 				{
681 669
 					$parent = null;
682 670
 					$objects[$id] = $object;
683
-				}
684
-				else
671
+				} else
685 672
 				{
686 673
 					$parent = $object[0];
687 674
 					$merged = [$parent,[$object[1]]];
688 675
 				}
689
-			}
690
-			else
676
+			} else
691 677
 				$merged[1][] = $object[1];
692 678
 		}
693 679
 		if($parent !== null)
@@ -726,8 +712,7 @@  discard block
 block discarded – undo
726 712
 					$attributes[$name] = $this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1);
727 713
 				else
728 714
 					$attributes[$name] = $this->parseTemplateProperty($value, $match[2][1]);
729
-			}
730
-			else
715
+			} else
731 716
 			{
732 717
 				if($value[0] === '\'' || $value[0] === '"')
733 718
 					$attributes[$name] = $this->parseAttribute(substr($value, 1, strlen($value) - 2));
@@ -776,8 +761,7 @@  discard block
 block discarded – undo
776 761
 				return [self::CONFIG_DATABIND,ltrim($expr, '.')];
777 762
 			else
778 763
 				return [self::CONFIG_EXPRESSION,ltrim($expr, '.')];
779
-		}
780
-		elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value)
764
+		} elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value)
781 765
 		{
782 766
 			$value = $matches[1];
783 767
 			if($value[2] === '~')
@@ -790,8 +774,7 @@  discard block
 block discarded – undo
790 774
 				$literal = trim(substr($value, 3, strlen($value) - 5));
791 775
 				return [self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"];
792 776
 			}
793
-		}
794
-		else
777
+		} else
795 778
 			return $value;
796 779
 	}
797 780
 
@@ -813,16 +796,14 @@  discard block
 block discarded – undo
813 796
 					$subname = substr($name, 0, $pos);
814 797
 					if(!$class->hasMethod('get' . $subname))
815 798
 						throw new TConfigurationException('template_property_unknown', $type, $subname);
816
-				}
817
-				elseif(strncasecmp($name, 'on', 2) === 0)
799
+				} elseif(strncasecmp($name, 'on', 2) === 0)
818 800
 				{
819 801
 					// an event
820 802
 					if(!$class->hasMethod($name))
821 803
 						throw new TConfigurationException('template_event_unknown', $type, $name);
822 804
 					elseif(!is_string($att))
823 805
 						throw new TConfigurationException('template_eventhandler_invalid', $type, $name);
824
-				}
825
-				else
806
+				} else
826 807
 				{
827 808
 					// a simple property
828 809
 					if (! ($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name)))
@@ -831,8 +812,7 @@  discard block
 block discarded – undo
831 812
 							throw new TConfigurationException('template_property_readonly', $type, $name);
832 813
 						else
833 814
 							throw new TConfigurationException('template_property_unknown', $type, $name);
834
-					}
835
-					elseif(is_array($att) && $att[0] !== self::CONFIG_EXPRESSION)
815
+					} elseif(is_array($att) && $att[0] !== self::CONFIG_EXPRESSION)
836 816
 					{
837 817
 						if(strcasecmp($name, 'id') === 0)
838 818
 							throw new TConfigurationException('template_controlid_invalid', $type);
@@ -841,8 +821,7 @@  discard block
 block discarded – undo
841 821
 					}
842 822
 				}
843 823
 			}
844
-		}
845
-		elseif(is_subclass_of($className, '\Prado\TComponent') || $className === '\Prado\TComponent')
824
+		} elseif(is_subclass_of($className, '\Prado\TComponent') || $className === '\Prado\TComponent')
846 825
 		{
847 826
 			foreach($attributes as $name => $att)
848 827
 			{
@@ -854,8 +833,7 @@  discard block
 block discarded – undo
854 833
 					$subname = substr($name, 0, $pos);
855 834
 					if(!$class->hasMethod('get' . $subname))
856 835
 						throw new TConfigurationException('template_property_unknown', $type, $subname);
857
-				}
858
-				elseif(strncasecmp($name, 'on', 2) === 0)
836
+				} elseif(strncasecmp($name, 'on', 2) === 0)
859 837
 					throw new TConfigurationException('template_event_forbidden', $type, $name);
860 838
 				else
861 839
 				{
@@ -869,8 +847,7 @@  discard block
 block discarded – undo
869 847
 					}
870 848
 				}
871 849
 			}
872
-		}
873
-		else
850
+		} else
874 851
 			throw new TConfigurationException('template_component_required', $type);
875 852
 		return $class->getName();
876 853
 	}
@@ -906,8 +883,7 @@  discard block
 block discarded – undo
906 883
 						$line = $line - $this->_includeAtLine[$i] + 1;
907 884
 						$srcFile = $this->_includedFiles[$i];
908 885
 						break;
909
-					}
910
-					else
886
+					} else
911 887
 						$line = $line - $this->_includeLines[$i] + 1;
912 888
 				}
913 889
 			}
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 	protected function configureEvent($control, $name, $value, $contextControl)
338 338
 	{
339 339
 		if(strpos($value, '.') === false)
340
-			$control->attachEventHandler($name, [$contextControl,'TemplateControl.' . $value]);
340
+			$control->attachEventHandler($name, [$contextControl, 'TemplateControl.' . $value]);
341 341
 		else
342
-			$control->attachEventHandler($name, [$contextControl,$value]);
342
+			$control->attachEventHandler($name, [$contextControl, $value]);
343 343
 	}
344 344
 
345 345
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 		}
391 391
 		else
392 392
 		{
393
-			if (substr($name, 0, 2) == 'js')
394
-				if ($value and !($value instanceof TJavaScriptLiteral))
393
+			if(substr($name, 0, 2) == 'js')
394
+				if($value and !($value instanceof TJavaScriptLiteral))
395 395
 					$value = new TJavaScriptLiteral($value);
396 396
 			$setter = 'set' . $name;
397 397
 			$component->$setter($value);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$this->_directive = null;
477 477
 		try
478 478
 		{
479
-			for($i = 0;$i < $n;++$i)
479
+			for($i = 0; $i < $n; ++$i)
480 480
 			{
481 481
 				$match = &$matches[$i];
482 482
 				$str = $match[0][0];
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 					if($expectPropEnd)
488 488
 						continue;
489 489
 					if($matchStart > $textStart)
490
-						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
490
+						$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
491 491
 					$textStart = $matchEnd + 1;
492 492
 					$type = $match[1][0];
493 493
 					$attributes = $this->parseAttributes($match[2][0], $match[2][1]);
494 494
 					$class = $this->validateAttributes($type, $attributes);
495
-					$tpl[$c++] = [$container,$class,$attributes];
495
+					$tpl[$c++] = [$container, $class, $attributes];
496 496
 					if($str[strlen($str) - 2] !== '/')  // open tag
497 497
 					{
498 498
 						$stack[] = $type;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 					if($expectPropEnd)
505 505
 						continue;
506 506
 					if($matchStart > $textStart)
507
-						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
507
+						$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
508 508
 					$textStart = $matchEnd + 1;
509 509
 					$type = $match[1][0];
510 510
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 					if($expectPropEnd)
525 525
 						continue;
526 526
 					if($matchStart > $textStart)
527
-						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
527
+						$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
528 528
 					$textStart = $matchEnd + 1;
529 529
 					if(isset($tpl[0]) || $this->_directive !== null)
530 530
 						throw new TConfigurationException('template_directive_nonunique');
@@ -535,25 +535,25 @@  discard block
 block discarded – undo
535 535
 					if($expectPropEnd)
536 536
 						continue;
537 537
 					if($matchStart > $textStart)
538
-						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
538
+						$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
539 539
 					$textStart = $matchEnd + 1;
540 540
 					$literal = trim($match[5][0]);
541 541
 					if($str[2] === '=')	// expression
542
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,$literal]];
542
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_EXPRESSION, $literal]];
543 543
 					elseif($str[2] === '%')  // statements
544
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_STATEMENTS,$literal]];
544
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_STATEMENTS, $literal]];
545 545
 					elseif($str[2] === '#')
546
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_DATABINDING,$literal]];
546
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_DATABINDING, $literal]];
547 547
 					elseif($str[2] === '$')
548
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"]];
548
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_EXPRESSION, "\$this->getApplication()->getParameters()->itemAt('$literal')"]];
549 549
 					elseif($str[2] === '~')
550
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"]];
550
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_EXPRESSION, "\$this->publishFilePath('$this->_contextPath/$literal')"]];
551 551
 					elseif($str[2] === '/')
552
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]];
552
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]];
553 553
 					elseif($str[2] === '[')
554 554
 					{
555
-						$literal = strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'","\\" => "\\\\"]);
556
-						$tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"]];
555
+						$literal = strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'", "\\" => "\\\\"]);
556
+						$tpl[$c++] = [$container, [TCompositeLiteral::TYPE_EXPRESSION, "Prado::localize('$literal')"]];
557 557
 					}
558 558
 				}
559 559
 				elseif(strpos($str, '<prop:') === 0)	// opening property
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 						if($expectPropEnd)
564 564
 							continue;
565 565
 						if($matchStart > $textStart)
566
-							$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
566
+							$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
567 567
 						$textStart = $matchEnd + 1;
568 568
 						$prop = strtolower($match[6][0]);
569 569
 						$attrs = $this->parseAttributes($match[7][0], $match[7][1]);
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 						if(!$expectPropEnd)
587 587
 						{
588 588
 							if($matchStart > $textStart)
589
-								$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
589
+								$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
590 590
 							$textStart = $matchEnd + 1;
591 591
 							$expectPropEnd = true;
592 592
 						}
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					if($expectPropEnd)
633 633
 						throw new TConfigurationException('template_comments_forbidden');
634 634
 					if($matchStart > $textStart)
635
-						$tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)];
635
+						$tpl[$c++] = [$container, substr($input, $textStart, $matchStart - $textStart)];
636 636
 					$textStart = $matchEnd + 1;
637 637
 				}
638 638
 				else
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 				throw new TConfigurationException('template_closingtag_expected', $tag, "nothing");
646 646
 			}
647 647
 			if($textStart < strlen($input))
648
-				$tpl[$c++] = [$container,substr($input, $textStart)];
648
+				$tpl[$c++] = [$container, substr($input, $textStart)];
649 649
 		}
650
-		catch(\Exception $e)
650
+		catch (\Exception $e)
651 651
 		{
652 652
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
653 653
 				throw $e;
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
 				if($parent !== null)
673 673
 				{
674 674
 					if(count($merged[1]) === 1 && is_string($merged[1][0]))
675
-						$objects[$id - 1] = [$merged[0],$merged[1][0]];
675
+						$objects[$id - 1] = [$merged[0], $merged[1][0]];
676 676
 					else
677
-						$objects[$id - 1] = [$merged[0],new TCompositeLiteral($merged[1])];
677
+						$objects[$id - 1] = [$merged[0], new TCompositeLiteral($merged[1])];
678 678
 				}
679 679
 				if(isset($object[2]))
680 680
 				{
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 				else
685 685
 				{
686 686
 					$parent = $object[0];
687
-					$merged = [$parent,[$object[1]]];
687
+					$merged = [$parent, [$object[1]]];
688 688
 				}
689 689
 			}
690 690
 			else
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
 		if($parent !== null)
694 694
 		{
695 695
 			if(count($merged[1]) === 1 && is_string($merged[1][0]))
696
-				$objects[$id] = [$merged[0],$merged[1][0]];
696
+				$objects[$id] = [$merged[0], $merged[1][0]];
697 697
 			else
698
-				$objects[$id] = [$merged[0],new TCompositeLiteral($merged[1])];
698
+				$objects[$id] = [$merged[0], new TCompositeLiteral($merged[1])];
699 699
 		}
700 700
 		$tpl = $objects;
701 701
 		return $objects;
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		$pattern = '/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS';
714 714
 		$attributes = [];
715 715
 		$n = preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
716
-		for($i = 0;$i < $n;++$i)
716
+		for($i = 0; $i < $n; ++$i)
717 717
 		{
718 718
 			$match = &$matches[$i];
719 719
 			$name = strtolower($match[1][0]);
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	protected function parseTemplateProperty($content, $offset)
742 742
 	{
743 743
 		$line = $this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1;
744
-		return [self::CONFIG_TEMPLATE,new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false)];
744
+		return [self::CONFIG_TEMPLATE, new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false)];
745 745
 	}
746 746
 
747 747
 	/**
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 			$isDataBind = false;
757 757
 			$textStart = 0;
758 758
 			$expr = '';
759
-			for($i = 0;$i < $n;++$i)
759
+			for($i = 0; $i < $n; ++$i)
760 760
 			{
761 761
 				$match = $matches[0][$i];
762 762
 				$token = $match[0];
@@ -765,30 +765,30 @@  discard block
 block discarded – undo
765 765
 				if($token[2] === '#')
766 766
 					$isDataBind = true;
767 767
 				if($offset > $textStart)
768
-					$expr .= ".'" . strtr(substr($value, $textStart, $offset - $textStart), ["'" => "\\'","\\" => "\\\\"]) . "'";
768
+					$expr .= ".'" . strtr(substr($value, $textStart, $offset - $textStart), ["'" => "\\'", "\\" => "\\\\"]) . "'";
769 769
 				$expr .= '.(' . substr($token, 3, $length - 5) . ')';
770 770
 				$textStart = $offset + $length;
771 771
 			}
772 772
 			$length = strlen($value);
773 773
 			if($length > $textStart)
774
-				$expr .= ".'" . strtr(substr($value, $textStart, $length - $textStart), ["'" => "\\'","\\" => "\\\\"]) . "'";
774
+				$expr .= ".'" . strtr(substr($value, $textStart, $length - $textStart), ["'" => "\\'", "\\" => "\\\\"]) . "'";
775 775
 			if($isDataBind)
776
-				return [self::CONFIG_DATABIND,ltrim($expr, '.')];
776
+				return [self::CONFIG_DATABIND, ltrim($expr, '.')];
777 777
 			else
778
-				return [self::CONFIG_EXPRESSION,ltrim($expr, '.')];
778
+				return [self::CONFIG_EXPRESSION, ltrim($expr, '.')];
779 779
 		}
780 780
 		elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value)
781 781
 		{
782 782
 			$value = $matches[1];
783 783
 			if($value[2] === '~')
784
-				return [self::CONFIG_ASSET,trim(substr($value, 3, strlen($value) - 5))];
784
+				return [self::CONFIG_ASSET, trim(substr($value, 3, strlen($value) - 5))];
785 785
 			elseif($value[2] === '[')
786
-				return [self::CONFIG_LOCALIZATION,trim(substr($value, 3, strlen($value) - 6))];
786
+				return [self::CONFIG_LOCALIZATION, trim(substr($value, 3, strlen($value) - 6))];
787 787
 			elseif($value[2] === '$')
788
-				return [self::CONFIG_PARAMETER,trim(substr($value, 3, strlen($value) - 5))];
788
+				return [self::CONFIG_PARAMETER, trim(substr($value, 3, strlen($value) - 5))];
789 789
 			elseif($value[2] === '/') {
790 790
 				$literal = trim(substr($value, 3, strlen($value) - 5));
791
-				return [self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"];
791
+				return [self::CONFIG_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"];
792 792
 			}
793 793
 		}
794 794
 		else
@@ -825,9 +825,9 @@  discard block
 block discarded – undo
825 825
 				else
826 826
 				{
827 827
 					// a simple property
828
-					if (! ($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name)))
828
+					if(!($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name)))
829 829
 					{
830
-						if ($class->hasMethod('get' . $name) || $class->hasMethod('getjs' . $name))
830
+						if($class->hasMethod('get' . $name) || $class->hasMethod('getjs' . $name))
831 831
 							throw new TConfigurationException('template_property_readonly', $type, $name);
832 832
 						else
833 833
 							throw new TConfigurationException('template_property_unknown', $type, $name);
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 
898 898
 		if(($n = count($this->_includedFiles)) > 0) // need to adjust error row number and file name
899 899
 		{
900
-			for($i = $n - 1;$i >= 0;--$i)
900
+			for($i = $n - 1; $i >= 0; --$i)
901 901
 			{
902 902
 				if($this->_includeAtLine[$i] <= $line)
903 903
 				{
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 	{
931 931
 		if($n = preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
932 932
 		{
933
-			for($i = 0;$i < $n;++$i)
933
+			for($i = 0; $i < $n; ++$i)
934 934
 			{
935 935
 				$filePath = Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT);
936 936
 				if($filePath !== null && is_file($filePath))
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 				}
943 943
 			}
944 944
 			$base = 0;
945
-			for($i = 0;$i < $n;++$i)
945
+			for($i = 0; $i < $n; ++$i)
946 946
 			{
947 947
 				$ext = file_get_contents($this->_includedFiles[$i]);
948 948
 				$length = strlen($matches[$i][0][0]);
Please login to merge, or discard this patch.