Completed
Push — prado4-sauce ( 31ba42...77d75b )
by Fabio
16:20 queued 08:27
created
framework/Web/UI/WebControls/TBaseValidator.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -518,16 +518,14 @@
 block discarded – undo
518 518
 				{
519 519
 					$this->setIsValid(true);
520 520
 					$this->onValidationSuccess();
521
-				}
522
-				else
521
+				} else
523 522
 				{
524 523
 					if($target)
525 524
 						$target->setIsValid(false);
526 525
 					$this->setIsValid(false);
527 526
 					$this->onValidationError();
528 527
 				}
529
-			}
530
-			else
528
+			} else
531 529
 			{
532 530
 				$this->evaluateIsValid();
533 531
 				$this->setIsValid(true);
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,6 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * TBaseValidator::$_clientClass, be sure to update the corresponding
186 186
 	 * "Javascript/validation3.js" file as well.
187 187
 	 * @param TControl control to validate.
188
+	 * @param \Prado\Web\UI\TControl $control
188 189
 	 * @return string control type for client-side validation.
189 190
 	 */
190 191
 	private function getClientControlClass($control)
@@ -263,7 +264,7 @@  discard block
 block discarded – undo
263 264
 	/**
264 265
 	 * Update the ControlToValidate component's css class depending
265 266
 	 * if the ControlCssClass property is set, and whether this is valid.
266
-	 * @return boolean true if change, false otherwise.
267
+	 * @return boolean|null true if change, false otherwise.
267 268
 	 */
268 269
 	protected function updateControlCssClass()
269 270
 	{
@@ -388,6 +389,7 @@  discard block
 block discarded – undo
388 389
 	 * The ID path is the dot-connected IDs of the controls reaching from
389 390
 	 * the validator's naming container to the target control.
390 391
 	 * @param string the ID path
392
+	 * @param string $value
391 393
 	 */
392 394
 	public function setControlToValidate($value)
393 395
 	{
@@ -476,7 +478,7 @@  discard block
 block discarded – undo
476 478
 	}
477 479
 
478 480
 	/**
479
-	 * @return TControl control to be validated. Null if no control is found.
481
+	 * @return \Prado\Web\UI\TControl control to be validated. Null if no control is found.
480 482
 	 * @throws TConfigurationException if {@link getControlToValidate
481 483
 	 * ControlToValidate} is empty or does not point to a valid control
482 484
 	 */
@@ -553,6 +555,7 @@  discard block
 block discarded – undo
553 555
 
554 556
 	/**
555 557
 	 * @param string the css class that is applied to the control being validated in case the validation fails
558
+	 * @param string $value
556 559
 	 */
557 560
 	public function setControlCssClass($value)
558 561
 	{
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * them specially.
95 95
 	 * @var array list of control class names
96 96
 	 */
97
-	private static $_clientClass = array('THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList');
97
+	private static $_clientClass=array('THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList');
98 98
 
99 99
 	/**
100 100
 	 * Constructor.
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 		$display=$this->getDisplay();
140 140
 		$visible=$this->getEnabled(true) && !$this->getIsValid();
141 141
 		if($display===TValidatorDisplayStyle::None || (!$visible && $display===TValidatorDisplayStyle::Dynamic))
142
-			$writer->addStyleAttribute('display','none');
142
+			$writer->addStyleAttribute('display', 'none');
143 143
 		else if(!$visible)
144
-			$writer->addStyleAttribute('visibility','hidden');
145
-		$writer->addAttribute('id',$this->getClientID());
144
+			$writer->addStyleAttribute('visibility', 'hidden');
145
+		$writer->addAttribute('id', $this->getClientID());
146 146
 		parent::addAttributesToRender($writer);
147 147
 		$this->renderClientControlScript($writer);
148 148
 	}
@@ -153,29 +153,29 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function getClientScriptOptions()
155 155
 	{
156
-		$control = $this->getValidationTarget();
157
-		$options['ID'] = $this->getClientID();
158
-		$options['FormID'] = $this->getPage()->getForm()->getClientID();
159
-		$options['Display'] = $this->getDisplay();
160
-		$options['ErrorMessage'] = $this->getErrorMessage();
156
+		$control=$this->getValidationTarget();
157
+		$options['ID']=$this->getClientID();
158
+		$options['FormID']=$this->getPage()->getForm()->getClientID();
159
+		$options['Display']=$this->getDisplay();
160
+		$options['ErrorMessage']=$this->getErrorMessage();
161 161
 		if($this->getFocusOnError())
162 162
 		{
163
-			$options['FocusOnError'] = $this->getFocusOnError();
164
-			$options['FocusElementID'] = $this->getFocusElementID();
163
+			$options['FocusOnError']=$this->getFocusOnError();
164
+			$options['FocusElementID']=$this->getFocusElementID();
165 165
 		}
166
-		$options['ValidationGroup'] = $this->getValidationGroup();
166
+		$options['ValidationGroup']=$this->getValidationGroup();
167 167
 		if($control)
168
-			$options['ControlToValidate'] = $control->getClientID();
169
-		$options['ControlCssClass'] = $this->getControlCssClass();
168
+			$options['ControlToValidate']=$control->getClientID();
169
+		$options['ControlCssClass']=$this->getControlCssClass();
170 170
 
171
-		$options['ControlType'] = $this->getClientControlClass($control);
172
-		$options['Enabled'] = $this->getEnabled(true);
171
+		$options['ControlType']=$this->getClientControlClass($control);
172
+		$options['Enabled']=$this->getEnabled(true);
173 173
 
174 174
 		//get date format from date picker target control
175 175
 		if($control instanceof TDatePicker)
176
-			$options['DateFormat'] = $control->getDateFormat();
176
+			$options['DateFormat']=$control->getDateFormat();
177 177
 
178
-		$options = array_merge($options,$this->getClientSide()->getOptions()->toArray());
178
+		$options=array_merge($options, $this->getClientSide()->getOptions()->toArray());
179 179
 
180 180
 		return $options;
181 181
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		foreach(self::$_clientClass as $type)
193 193
 			if($control instanceof $type)
194 194
 				return $type;
195
-		$reflectionClass = new \ReflectionClass($control);
195
+		$reflectionClass=new \ReflectionClass($control);
196 196
 		return $reflectionClass->getShortName();
197 197
 	}
198 198
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	public function getClientSide()
216 216
 	{
217 217
 		if($this->_clientSide===null)
218
-			$this->_clientSide = $this->createClientSide();
218
+			$this->_clientSide=$this->createClientSide();
219 219
 		return $this->_clientSide;
220 220
 	}
221 221
 
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function renderClientControlScript($writer)
237 237
 	{
238
-		$scripts = $this->getPage()->getClientScript();
239
-		if ($this->getEnableClientScript())
238
+		$scripts=$this->getPage()->getClientScript();
239
+		if($this->getEnableClientScript())
240 240
 			$scripts->registerPradoScript('validator');
241 241
 		$formID=$this->getPage()->getForm()->getClientID();
242
-		$scriptKey = "TBaseValidator:$formID";
242
+		$scriptKey="TBaseValidator:$formID";
243 243
 		if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey))
244 244
 		{
245
-			$manager['FormID'] = $formID;
246
-			$options = TJavaScript::encode($manager);
245
+			$manager['FormID']=$formID;
246
+			$options=TJavaScript::encode($manager);
247 247
 			$scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});");
248 248
 		}
249 249
 		if($this->getEnableClientScript())
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 * Override parent implementation to update the control CSS Class before
255 255
 	 * the validated control is rendered
256 256
 	 */
257
-	public function onPreRender ($param)
257
+	public function onPreRender($param)
258 258
 	{
259 259
 		parent::onPreRender($param);
260 260
 		$this->updateControlCssClass();
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 			$control=$this->getValidationTarget();
273 273
 			if($control instanceof TWebControl)
274 274
 			{
275
-				$class = preg_replace ('/ '.preg_quote($cssClass).'/', '',$control->getCssClass());
275
+				$class=preg_replace('/ '.preg_quote($cssClass).'/', '', $control->getCssClass());
276 276
 				if(!$this->getIsValid())
277 277
 				{
278
-					$class .= ' '.$cssClass;
278
+					$class.=' '.$cssClass;
279 279
 					$control->setCssClass($class);
280
-				} elseif ($control->getIsValid())
280
+				} elseif($control->getIsValid())
281 281
 					$control->setCssClass($class);
282 282
 			}
283 283
 		}
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	protected function registerClientScriptValidator()
290 290
 	{
291
-		$key = 'prado:'.$this->getClientID();
291
+		$key='prado:'.$this->getClientID();
292 292
 		if(!$this->getPage()->getClientScript()->isEndScriptRegistered($key))
293 293
 		{
294
-			$options = TJavaScript::encode($this->getClientScriptOptions());
295
-			$script = 'new '.$this->getClientClassName().'('.$options.');';
294
+			$options=TJavaScript::encode($this->getClientScriptOptions());
295
+			$script='new '.$this->getClientClassName().'('.$options.');';
296 296
 			$this->getPage()->getClientScript()->registerEndScript($key, $script);
297 297
 		}
298 298
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	public function setForControl($value)
313 313
 	{
314
-		throw new TNotSupportedException('basevalidator_forcontrol_unsupported',get_class($this));
314
+		throw new TNotSupportedException('basevalidator_forcontrol_unsupported', get_class($this));
315 315
 	}
316 316
 
317 317
 	/**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	public function getDisplay()
333 333
 	{
334
-		return $this->getViewState('Display',TValidatorDisplayStyle::Fixed);
334
+		return $this->getViewState('Display', TValidatorDisplayStyle::Fixed);
335 335
 	}
336 336
 
337 337
 	/**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function setDisplay($value)
341 341
 	{
342
-		$this->setViewState('Display',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TValidatorDisplayStyle'),TValidatorDisplayStyle::Fixed);
342
+		$this->setViewState('Display', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TValidatorDisplayStyle'), TValidatorDisplayStyle::Fixed);
343 343
 	}
344 344
 
345 345
 	/**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public function getEnableClientScript()
349 349
 	{
350
-		return $this->getViewState('EnableClientScript',true);
350
+		return $this->getViewState('EnableClientScript', true);
351 351
 	}
352 352
 
353 353
 	/**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	public function setEnableClientScript($value)
357 357
 	{
358
-		$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
358
+		$this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
359 359
 	}
360 360
 
361 361
 	/**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	public function getErrorMessage()
365 365
 	{
366
-		return $this->getViewState('ErrorMessage','');
366
+		return $this->getViewState('ErrorMessage', '');
367 367
 	}
368 368
 
369 369
 	/**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function setErrorMessage($value)
374 374
 	{
375
-		$this->setViewState('ErrorMessage',$value,'');
375
+		$this->setViewState('ErrorMessage', $value, '');
376 376
 	}
377 377
 
378 378
 	/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 */
381 381
 	public function getControlToValidate()
382 382
 	{
383
-		return $this->getViewState('ControlToValidate','');
383
+		return $this->getViewState('ControlToValidate', '');
384 384
 	}
385 385
 
386 386
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function setControlToValidate($value)
393 393
 	{
394
-		$this->setViewState('ControlToValidate',$value,'');
394
+		$this->setViewState('ControlToValidate', $value, '');
395 395
 	}
396 396
 
397 397
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	public function getFocusOnError()
401 401
 	{
402
-		return $this->getViewState('FocusOnError',false);
402
+		return $this->getViewState('FocusOnError', false);
403 403
 	}
404 404
 
405 405
 	/**
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	public function setFocusOnError($value)
409 409
 	{
410
-		$this->setViewState('FocusOnError',TPropertyValue::ensureBoolean($value),false);
410
+		$this->setViewState('FocusOnError', TPropertyValue::ensureBoolean($value), false);
411 411
 	}
412 412
 
413 413
 	/**
@@ -417,13 +417,13 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function getFocusElementID()
419 419
 	{
420
-		if(($id=$this->getViewState('FocusElementID',''))==='')
420
+		if(($id=$this->getViewState('FocusElementID', ''))==='')
421 421
 		{
422 422
 			$target=$this->getValidationTarget();
423 423
 			/* Workaround: TCheckBoxList and TRadioButtonList nests the actual
424 424
 			 * inputs inside a table; we ensure the first input gets focused
425 425
 			 */
426
-			if($target instanceof TCheckBoxList && $target->getItemCount()>0)
426
+			if($target instanceof TCheckBoxList && $target->getItemCount() > 0)
427 427
 			{
428 428
 				$id=$target->getClientID().'_c0';
429 429
 			} else {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function getValidationGroup()
449 449
 	{
450
-		return $this->getViewState('ValidationGroup','');
450
+		return $this->getViewState('ValidationGroup', '');
451 451
 	}
452 452
 
453 453
 	/**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	public function setValidationGroup($value)
457 457
 	{
458
-		$this->setViewState('ValidationGroup',$value,'');
458
+		$this->setViewState('ValidationGroup', $value, '');
459 459
 	}
460 460
 
461 461
 	/**
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
486 486
 			return $control;
487 487
 		else
488
-			throw new TConfigurationException('basevalidator_controltovalidate_invalid',get_class($this));
488
+			throw new TConfigurationException('basevalidator_controltovalidate_invalid', get_class($this));
489 489
 	}
490 490
 
491 491
 	/**
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 		if($control instanceof \Prado\Web\UI\IValidatable)
500 500
 			return $control->getValidationPropertyValue();
501 501
 		else
502
-			throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
502
+			throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this));
503 503
 	}
504 504
 
505 505
 	/**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 */
549 549
 	public function getControlCssClass()
550 550
 	{
551
-		return $this->getViewState('ControlCssClass','');
551
+		return $this->getViewState('ControlCssClass', '');
552 552
 	}
553 553
 
554 554
 	/**
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function setControlCssClass($value)
558 558
 	{
559
-		$this->setViewState('ControlCssClass',$value,'');
559
+		$this->setViewState('ControlCssClass', $value, '');
560 560
 	}
561 561
 
562 562
 	/**
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	 */
572 572
 	public function onValidationSuccess()
573 573
 	{
574
-		$this->raiseEvent('OnValidationSuccess',$this,null);
574
+		$this->raiseEvent('OnValidationSuccess', $this, null);
575 575
 	}
576 576
 
577 577
 	/**
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	public function onValidationError()
581 581
 	{
582
-		$this->raiseEvent('OnValidationError',$this,null);
582
+		$this->raiseEvent('OnValidationError', $this, null);
583 583
 	}
584 584
 
585 585
 	/**
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function onValidate()
592 592
 	{
593
-		$this->raiseEvent('OnValidate',$this,null);
593
+		$this->raiseEvent('OnValidate', $this, null);
594 594
 	}
595 595
 
596 596
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TClientScript.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	public function onPreRender($param)
106 106
 	{
107 107
 		parent::onPreRender($param);
108
-		$scripts = preg_split('/,|\s+/', $this->getPradoScripts());
109
-		$cs = $this->getPage()->getClientScript();
108
+		$scripts=preg_split('/,|\s+/', $this->getPradoScripts());
109
+		$cs=$this->getPage()->getClientScript();
110 110
 		foreach($scripts as $script)
111 111
 		{
112
-			if(($script = trim($script))!=='')
112
+			if(($script=trim($script))!=='')
113 113
 				$cs->registerPradoScript($script);
114 114
 		}
115 115
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function render($writer)
124 124
 	{
125
-		if ($this->getFlushScriptFiles())
125
+		if($this->getFlushScriptFiles())
126 126
 			$this->getPage()->getClientScript()->flushScriptFiles($writer, $this);
127 127
 		$this->renderCustomScriptFile($writer);
128 128
 		$this->renderCustomScript($writer);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function renderCustomScriptFile($writer)
136 136
 	{
137
-		if(($scriptUrl = $this->getScriptUrl())!=='')
137
+		if(($scriptUrl=$this->getScriptUrl())!=='')
138 138
 			$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
139 139
 	}
140 140
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TMarkdown.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function processText($text)
53 53
 	{
54
-		$result = Parsedown::instance()->parse($text);
54
+		$result=Parsedown::instance()->parse($text);
55 55
 		return preg_replace_callback(
56 56
 				'/<pre><code class="language-(\w+)">((.|\n)*?)<\\/code><\\/pre>/im',
57 57
 				array($this, 'highlightCode'), $result);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	protected function highlightCode($matches)
66 66
 	{
67
-		$text = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
67
+		$text=html_entity_decode($matches[2], ENT_QUOTES, 'UTF-8');
68 68
 		$this->setLanguage($matches[1]);
69 69
 		return parent::processText($text);
70 70
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TLabel.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	protected function getTagName()
39 39
 	{
40
-		return ($this->getForControl()==='')?'span':'label';
40
+		return ($this->getForControl()==='') ? 'span' : 'label';
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	protected function addAttributesToRender($writer)
49 49
 	{
50 50
 		if($this->_forControl!=='')
51
-			$writer->addAttribute('for',$this->_forControl);
51
+			$writer->addAttribute('for', $this->_forControl);
52 52
 		parent::addAttributesToRender($writer);
53 53
 	}
54 54
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				}
72 72
 			}
73 73
 			else
74
-				throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid);
74
+				throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid);
75 75
 		}
76 76
 		else
77 77
 			parent::render($writer);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getText()
96 96
 	{
97
-		return $this->getViewState('Text','');
97
+		return $this->getViewState('Text', '');
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setText($value)
104 104
 	{
105
-		$this->setViewState('Text',TPropertyValue::ensureString($value),'');
105
+		$this->setViewState('Text', TPropertyValue::ensureString($value), '');
106 106
 	}
107 107
 
108 108
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function getForControl()
138 138
 	{
139
-		return $this->getViewState('ForControl','');
139
+		return $this->getViewState('ForControl', '');
140 140
 	}
141 141
 
142 142
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function setForControl($value)
148 148
 	{
149
-		$this->setViewState('ForControl',$value,'');
149
+		$this->setViewState('ForControl', $value, '');
150 150
 	}
151 151
 }
152 152
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 				$newid=substr($id,$pos+1);
234 234
 				if ($control!==null)
235 235
 					$control=$control->$newid;
236
-			}
237
-			else
236
+			} else
238 237
 			{
239 238
 				// TCheckBoxList overrides findControl() with a fake implementation
240 239
 				// but accepts a second parameter to use the standard one
@@ -296,8 +295,7 @@  discard block
 block discarded – undo
296 295
 		{
297 296
 			$group=$this->getValidationGroup();
298 297
 			return $this->getPage()->getValidators($group)->getCount()>0;
299
-		}
300
-		else
298
+		} else
301 299
 			return false;
302 300
 	}
303 301
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListControlValidator.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function getMinSelection()
78 78
 	{
79
-		return $this->getViewState('MinSelection',-1);
79
+		return $this->getViewState('MinSelection', -1);
80 80
 	}
81 81
 
82 82
 	/**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setMinSelection($value)
86 86
 	{
87
-		if(($value=TPropertyValue::ensureInteger($value))<0)
87
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
88 88
 			$value=-1;
89
-		$this->setViewState('MinSelection',$value,-1);
89
+		$this->setViewState('MinSelection', $value, -1);
90 90
 	}
91 91
 
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getMaxSelection()
96 96
 	{
97
-		return $this->getViewState('MaxSelection',-1);
97
+		return $this->getViewState('MaxSelection', -1);
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setMaxSelection($value)
104 104
 	{
105
-		if(($value=TPropertyValue::ensureInteger($value))<0)
105
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
106 106
 			$value=-1;
107
-		$this->setViewState('MaxSelection',$value,-1);
107
+		$this->setViewState('MaxSelection', $value, -1);
108 108
 	}
109 109
 
110 110
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function getRequiredSelections()
115 115
 	{
116
-		return $this->getViewState('RequiredSelections','');
116
+		return $this->getViewState('RequiredSelections', '');
117 117
 	}
118 118
 
119 119
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function setRequiredSelections($value)
124 124
 	{
125
-		$this->setViewState('RequiredSelections',$value,'');
125
+		$this->setViewState('RequiredSelections', $value, '');
126 126
 	}
127 127
 
128 128
 	/**
@@ -135,28 +135,28 @@  discard block
 block discarded – undo
135 135
 	{
136 136
 		$control=$this->getValidationTarget();
137 137
 
138
-		$exists = true;
139
-		$values = $this->getSelection($control);
140
-		$count = count($values);
141
-		$required = $this->getRequiredValues();
138
+		$exists=true;
139
+		$values=$this->getSelection($control);
140
+		$count=count($values);
141
+		$required=$this->getRequiredValues();
142 142
 
143 143
 		//if required, check the values
144 144
 		if(!empty($required))
145 145
 		{
146
-			if($count < count($required) )
146
+			if($count < count($required))
147 147
 				return false;
148 148
 			foreach($required as $require)
149
-				$exists = $exists && in_array($require, $values);
149
+				$exists=$exists && in_array($require, $values);
150 150
 		}
151 151
 
152
-		$min = $this->getMinSelection();
153
-		$max = $this->getMaxSelection();
152
+		$min=$this->getMinSelection();
153
+		$max=$this->getMaxSelection();
154 154
 
155
-		if($min !== -1 && $max !== -1)
155
+		if($min!==-1 && $max!==-1)
156 156
 			return $exists && $count >= $min && $count <= $max;
157
-		else if($min === -1 && $max !== -1)
157
+		else if($min===-1 && $max!==-1)
158 158
 			return $exists && $count <= $max;
159
-		else if($min !== -1 && $max === -1)
159
+		else if($min!==-1 && $max===-1)
160 160
 			return $exists && $count >= $min;
161 161
 		else
162 162
 			return $exists;
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function getSelection($control)
170 170
 	{
171
-		$values = array();
171
+		$values=array();
172 172
 
173 173
 		//get the data
174 174
 		foreach($control->getItems() as $item)
175 175
 		{
176 176
 			if($item->getSelected())
177
-				$values[] = $item->getValue();
177
+				$values[]=$item->getValue();
178 178
 		}
179 179
 		return $values;
180 180
 	}
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function getRequiredValues()
186 186
 	{
187
-		$required = array();
188
-		$string = $this->getRequiredSelections();
187
+		$required=array();
188
+		$string=$this->getRequiredSelections();
189 189
 		if(!empty($string))
190
-			$required = preg_split('/,\s*/', $string);
190
+			$required=preg_split('/,\s*/', $string);
191 191
 		return $required;
192 192
 	}
193 193
 
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	protected function getClientScriptOptions()
199 199
 	{
200
-		$options = parent::getClientScriptOptions();
201
-		$control = $this->getValidationTarget();
200
+		$options=parent::getClientScriptOptions();
201
+		$control=$this->getValidationTarget();
202 202
 
203 203
 		if(!$control instanceof TListControl)
204 204
 		{
205 205
 			throw new TConfigurationException(
206 206
 				'listcontrolvalidator_invalid_control',
207
-				$this->getID(),$this->getControlToValidate(), get_class($control));
207
+				$this->getID(), $this->getControlToValidate(), get_class($control));
208 208
 		}
209 209
 
210
-		$min = $this->getMinSelection();
211
-		$max = $this->getMaxSelection();
212
-		if($min !== -1)
213
-			$options['Min']= $min;
214
-		if($max !== -1)
215
-			$options['Max']= $max;
216
-		$required = $this->getRequiredSelections();
210
+		$min=$this->getMinSelection();
211
+		$max=$this->getMaxSelection();
212
+		if($min!==-1)
213
+			$options['Min']=$min;
214
+		if($max!==-1)
215
+			$options['Max']=$max;
216
+		$required=$this->getRequiredSelections();
217 217
 		if(strlen($required) > 0)
218
-			$options['Required']= $required;
219
-		$options['TotalItems'] = $control->getItemCount();
218
+			$options['Required']=$required;
219
+		$options['TotalItems']=$control->getItemCount();
220 220
 
221 221
 		return $options;
222 222
 	}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -163,6 +163,7 @@
 block discarded – undo
163 163
 
164 164
 	/**
165 165
 	 * @param TListControl control to validate
166
+	 * @param \Prado\Web\UI\TControl $control
166 167
 	 * @return array number of selected values and its values.
167 168
 	 */
168 169
 	protected function getSelection($control)
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListItem.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param boolean whether the item is enabled
54 54
 	 * @param boolean whether the item is selected
55 55
 	 */
56
-	public function __construct($text='',$value='',$enabled=true,$selected=false)
56
+	public function __construct($text='', $value='', $enabled=true, $selected=false)
57 57
 	{
58 58
 		$this->setText($text);
59 59
 		$this->setValue($value);
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 	protected function __getZappableSleepProps(&$exprops)
71 71
 	{
72 72
 		parent::__getZappableSleepProps($exprops);
73
-		if ($this->_attributes===null)
74
-			$exprops[] = "\0TListItem\0_attributes";
73
+		if($this->_attributes===null)
74
+			$exprops[]="\0TListItem\0_attributes";
75 75
 		if($this->_text==='')
76
-			$exprops[] = "\0TListItem\0_text";
76
+			$exprops[]="\0TListItem\0_text";
77 77
 		if($this->_value==='')
78
-			$exprops[] = "\0TListItem\0_value";
79
-		if ($this->_enabled===true)
80
-			$exprops[] = "\0TListItem\0_enabled";
81
-		if ($this->_selected===false)
82
-			$exprops[] = "\0TListItem\0_selected";
78
+			$exprops[]="\0TListItem\0_value";
79
+		if($this->_enabled===true)
80
+			$exprops[]="\0TListItem\0_enabled";
81
+		if($this->_selected===false)
82
+			$exprops[]="\0TListItem\0_selected";
83 83
 	}
84 84
 
85 85
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function getText()
121 121
 	{
122
-		return $this->_text===''?$this->_value:$this->_text;
122
+		return $this->_text==='' ? $this->_value : $this->_text;
123 123
 	}
124 124
 
125 125
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getValue()
137 137
 	{
138
-		return $this->_value===''?$this->_text:$this->_value;
138
+		return $this->_value==='' ? $this->_text : $this->_value;
139 139
 	}
140 140
 
141 141
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function getHasAttributes()
163 163
 	{
164
-		return $this->_attributes && $this->_attributes->getCount()>0;
164
+		return $this->_attributes && $this->_attributes->getCount() > 0;
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function hasAttribute($name)
172 172
 	{
173
-		return $this->_attributes?$this->_attributes->contains($name):false;
173
+		return $this->_attributes ? $this->_attributes->contains($name) : false;
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function getAttribute($name)
180 180
 	{
181
-		return $this->_attributes?$this->_attributes->itemAt($name):null;
181
+		return $this->_attributes ? $this->_attributes->itemAt($name) : null;
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @param string attribute name
186 186
 	 * @param string value of the attribute
187 187
 	 */
188
-	public function setAttribute($name,$value)
188
+	public function setAttribute($name, $value)
189 189
 	{
190
-		$this->getAttributes()->add($name,$value);
190
+		$this->getAttributes()->add($name, $value);
191 191
 	}
192 192
 
193 193
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function removeAttribute($name)
199 199
 	{
200
-		return $this->_attributes?$this->_attributes->remove($name):null;
200
+		return $this->_attributes ? $this->_attributes->remove($name) : null;
201 201
 	}
202 202
 }
203 203
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -97,6 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 	/**
99 99
 	 * @param boolean whether the item is enabled
100
+	 * @param boolean $value
100 101
 	 */
101 102
 	public function setEnabled($value)
102 103
 	{
@@ -113,6 +114,7 @@  discard block
 block discarded – undo
113 114
 
114 115
 	/**
115 116
 	 * @param boolean whether the item is selected
117
+	 * @param boolean $value
116 118
 	 */
117 119
 	public function setSelected($value)
118 120
 	{
@@ -145,6 +147,7 @@  discard block
 block discarded – undo
145 147
 
146 148
 	/**
147 149
 	 * @param string value of the item
150
+	 * @param string $value
148 151
 	 */
149 152
 	public function setValue($value)
150 153
 	{
Please login to merge, or discard this patch.
framework/Web/UI/TSessionPageStatePersister.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setHistorySize($value)
81 81
 	{
82
-		if(($value=TPropertyValue::ensureInteger($value))>0)
82
+		if(($value=TPropertyValue::ensureInteger($value)) > 0)
83 83
 			$this->_historySize=$value;
84 84
 		else
85 85
 			throw new TInvalidDataValueException('sessionpagestatepersister_historysize_invalid');
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 		$session=$this->_page->getSession();
94 94
 		$session->open();
95 95
 		$data=serialize($state);
96
-		$timestamp=(string)microtime(true);
96
+		$timestamp=(string) microtime(true);
97 97
 		$key=self::STATE_SESSION_KEY.$timestamp;
98
-		$session->add($key,$data);
98
+		$session->add($key, $data);
99 99
 		if(($queue=$session->itemAt(self::QUEUE_SESSION_KEY))===null)
100 100
 			$queue=array();
101 101
 		$queue[]=$key;
102
-		if(count($queue)>$this->getHistorySize())
102
+		if(count($queue) > $this->getHistorySize())
103 103
 		{
104 104
 			$expiredKey=array_shift($queue);
105 105
 			$session->remove($expiredKey);
106 106
 		}
107
-		$session->add(self::QUEUE_SESSION_KEY,$queue);
108
-		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp));
107
+		$session->add(self::QUEUE_SESSION_KEY, $queue);
108
+		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp));
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function load()
117 117
 	{
118
-		if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null)
118
+		if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null)
119 119
 		{
120 120
 			$session=$this->_page->getSession();
121 121
 			$session->open();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			if(($data=$session->itemAt($key))!==null)
124 124
 				return unserialize($data);
125 125
 		}
126
-		throw new THttpException(400,'sessionpagestatepersister_pagestate_corrupted');
126
+		throw new THttpException(400, 'sessionpagestatepersister_pagestate_corrupted');
127 127
 	}
128 128
 }
129 129
 
Please login to merge, or discard this patch.
framework/Web/UI/TControlAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	 */
49 49
 	public function getPage()
50 50
 	{
51
-		return $this->_control?$this->_control->getPage():null;
51
+		return $this->_control ? $this->_control->getPage() : null;
52 52
 	}
53 53
 
54 54
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/THtmlWriter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 	public function setWriter($writer)
90 90
 	{
91
-		$this->_writer = $writer;
91
+		$this->_writer=$writer;
92 92
 	}
93 93
 	/**
94 94
 	 * Adds a list of attributes to be rendered.
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string name of the attribute
106 106
 	 * @param string value of the attribute
107 107
 	 */
108
-	public function addAttribute($name,$value)
108
+	public function addAttribute($name, $value)
109 109
 	{
110 110
 		$this->_attributes[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
111 111
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string stylesheet attribute name
135 135
 	 * @param string stylesheet attribute value
136 136
 	 */
137
-	public function addStyleAttribute($name,$value)
137
+	public function addStyleAttribute($name, $value)
138 138
 	{
139 139
 		$this->_styles[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
140 140
 	}
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 		if(isset(self::$_simpleTags[$tagName]))
204 204
 		{
205 205
 			$str.=' />';
206
-			$this->_openTags[] = '';
206
+			$this->_openTags[]='';
207 207
 		}
208 208
 		else
209 209
 		{
210 210
 			$str.='>';
211
-			$this->_openTags[] = $tagName;
211
+			$this->_openTags[]=$tagName;
212 212
 		}
213 213
 		$this->_writer->write($str);
214 214
 		$this->_attributes=array();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.