Completed
Push — remove_deprecates ( 1de955 )
by Fabio
07:55
created
framework/Web/UI/WebControls/TPager.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -333,6 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 	/**
335 335
 	 * @param integer the zero-based index of the current page
336
+	 * @param integer $value
336 337
 	 * @throws TInvalidDataValueException if the value is less than 0
337 338
 	 */
338 339
 	protected function setCurrentPageIndex($value)
@@ -352,6 +353,7 @@  discard block
 block discarded – undo
352 353
 
353 354
 	/**
354 355
 	 * @param integer number of pages of data items available
356
+	 * @param integer $value
355 357
 	 * @throws TInvalidDataValueException if the value is less than 0
356 358
 	 */
357 359
 	protected function setPageCount($value)
@@ -446,6 +448,9 @@  discard block
 block discarded – undo
446 448
 	 * @param string caption of the button.
447 449
 	 * @param string CommandName corresponding to the OnCommand event of the button.
448 450
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
451
+	 * @param TPagerButtonType $buttonType
452
+	 * @param boolean $enabled
453
+	 * @param string $commandName
449 454
 	 * @return mixed the button instance
450 455
 	 */
451 456
 	protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
@@ -660,6 +665,7 @@  discard block
 block discarded – undo
660 665
 	/**
661 666
 	 * This event is raised when page index is changed due to a page button click.
662 667
 	 * @param TPagerPageChangedEventParameter event parameter
668
+	 * @param TPagerPageChangedEventParameter $param
663 669
 	 */
664 670
 	public function onPageIndexChanged($param)
665 671
 	{
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function getControlToPaginate()
87 87
 	{
88
-		return $this->getViewState('ControlToPaginate','');
88
+		return $this->getViewState('ControlToPaginate', '');
89 89
 	}
90 90
 
91 91
 	/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function setControlToPaginate($value)
98 98
 	{
99
-		$this->setViewState('ControlToPaginate',$value,'');
99
+		$this->setViewState('ControlToPaginate', $value, '');
100 100
 	}
101 101
 
102 102
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getButtonCssClass()
107 107
 	{
108
-		return $this->getViewState('ButtonCssClass','');
108
+		return $this->getViewState('ButtonCssClass', '');
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setButtonCssClass($value)
116 116
 	{
117
-		$this->setViewState('ButtonCssClass',TPropertyValue::ensureString($value,''),'');
117
+		$this->setViewState('ButtonCssClass', TPropertyValue::ensureString($value, ''), '');
118 118
 	}
119 119
 
120 120
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function getMode()
124 124
 	{
125
-		return $this->getViewState('Mode',TPagerMode::NextPrev);
125
+		return $this->getViewState('Mode', TPagerMode::NextPrev);
126 126
 	}
127 127
 
128 128
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function setMode($value)
132 132
 	{
133
-		$this->setViewState('Mode',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TPagerMode'),TPagerMode::NextPrev);
133
+		$this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TPagerMode'), TPagerMode::NextPrev);
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function getButtonType()
140 140
 	{
141
-		return $this->getViewState('ButtonType',TPagerButtonType::LinkButton);
141
+		return $this->getViewState('ButtonType', TPagerButtonType::LinkButton);
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function setButtonType($value)
148 148
 	{
149
-		$this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TPagerButtonType'),TPagerButtonType::LinkButton);
149
+		$this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TPagerButtonType'), TPagerButtonType::LinkButton);
150 150
 	}
151 151
 
152 152
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function getNextPageText()
156 156
 	{
157
-		return $this->getViewState('NextPageText','>');
157
+		return $this->getViewState('NextPageText', '>');
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function setNextPageText($value)
164 164
 	{
165
-		$this->setViewState('NextPageText',$value,'>');
165
+		$this->setViewState('NextPageText', $value, '>');
166 166
 	}
167 167
 
168 168
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function getPrevPageText()
172 172
 	{
173
-		return $this->getViewState('PrevPageText','<');
173
+		return $this->getViewState('PrevPageText', '<');
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function setPrevPageText($value)
180 180
 	{
181
-		$this->setViewState('PrevPageText',$value,'<');
181
+		$this->setViewState('PrevPageText', $value, '<');
182 182
 	}
183 183
 
184 184
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function getFirstPageText()
188 188
 	{
189
-		return $this->getViewState('FirstPageText','<<');
189
+		return $this->getViewState('FirstPageText', '<<');
190 190
 	}
191 191
 
192 192
 	/**
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function setFirstPageText($value)
196 196
 	{
197
-		$this->setViewState('FirstPageText',$value,'<<');
197
+		$this->setViewState('FirstPageText', $value, '<<');
198 198
 	}
199 199
 
200 200
 	/**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function getLastPageText()
204 204
 	{
205
-		return $this->getViewState('LastPageText','>>');
205
+		return $this->getViewState('LastPageText', '>>');
206 206
 	}
207 207
 
208 208
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function setLastPageText($value)
212 212
 	{
213
-		$this->setViewState('LastPageText',$value,'>>');
213
+		$this->setViewState('LastPageText', $value, '>>');
214 214
 	}
215 215
 
216 216
 	/**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function getFirstPageImageUrl()
221 221
 	{
222
-		return $this->getViewState('FirstPageImageUrl','');
222
+		return $this->getViewState('FirstPageImageUrl', '');
223 223
 	}
224 224
 
225 225
 	/**
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function setFirstPageImageUrl($value)
230 230
 	{
231
-		$this->setViewState('FirstPageImageUrl',$value);
231
+		$this->setViewState('FirstPageImageUrl', $value);
232 232
 	}
233 233
 
234 234
 	/**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function getLastPageImageUrl()
239 239
 	{
240
-		return $this->getViewState('LastPageImageUrl','');
240
+		return $this->getViewState('LastPageImageUrl', '');
241 241
 	}
242 242
 
243 243
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function setLastPageImageUrl($value)
248 248
 	{
249
-		$this->setViewState('LastPageImageUrl',$value);
249
+		$this->setViewState('LastPageImageUrl', $value);
250 250
 	}
251 251
 
252 252
 	/**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	public function getNextPageImageUrl()
257 257
 	{
258
-		return $this->getViewState('NextPageImageUrl','');
258
+		return $this->getViewState('NextPageImageUrl', '');
259 259
 	}
260 260
 
261 261
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public function setNextPageImageUrl($value)
266 266
 	{
267
-		$this->setViewState('NextPageImageUrl',$value);
267
+		$this->setViewState('NextPageImageUrl', $value);
268 268
 	}
269 269
 
270 270
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function getPrevPageImageUrl()
275 275
 	{
276
-		return $this->getViewState('PrevPageImageUrl','');
276
+		return $this->getViewState('PrevPageImageUrl', '');
277 277
 	}
278 278
 
279 279
 	/**
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	public function setPrevPageImageUrl($value)
284 284
 	{
285
-		$this->setViewState('PrevPageImageUrl',$value);
285
+		$this->setViewState('PrevPageImageUrl', $value);
286 286
 	}
287 287
 
288 288
 	/**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function getNumericPageImageUrl()
294 294
 	{
295
-		return $this->getViewState('NumericPageImageUrl','');
295
+		return $this->getViewState('NumericPageImageUrl', '');
296 296
 	}
297 297
 
298 298
 	/**
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 */
307 307
 	public function setNumericPageImageUrl($value)
308 308
 	{
309
-		$this->setViewState('NumericPageImageUrl',$value);
309
+		$this->setViewState('NumericPageImageUrl', $value);
310 310
 	}
311 311
 
312 312
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	public function getPageButtonCount()
316 316
 	{
317
-		return $this->getViewState('PageButtonCount',10);
317
+		return $this->getViewState('PageButtonCount', 10);
318 318
 	}
319 319
 
320 320
 	/**
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function setPageButtonCount($value)
325 325
 	{
326
-		if(($value=TPropertyValue::ensureInteger($value))<1)
326
+		if(($value=TPropertyValue::ensureInteger($value)) < 1)
327 327
 			throw new TInvalidDataValueException('pager_pagebuttoncount_invalid');
328
-		$this->setViewState('PageButtonCount',$value,10);
328
+		$this->setViewState('PageButtonCount', $value, 10);
329 329
 	}
330 330
 
331 331
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	public function getCurrentPageIndex()
335 335
 	{
336
-		return $this->getViewState('CurrentPageIndex',0);
336
+		return $this->getViewState('CurrentPageIndex', 0);
337 337
 	}
338 338
 
339 339
 	/**
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	protected function setCurrentPageIndex($value)
344 344
 	{
345
-		if(($value=TPropertyValue::ensureInteger($value))<0)
345
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
346 346
 			throw new TInvalidDataValueException('pager_currentpageindex_invalid');
347
-		$this->setViewState('CurrentPageIndex',$value,0);
347
+		$this->setViewState('CurrentPageIndex', $value, 0);
348 348
 	}
349 349
 
350 350
 	/**
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	public function getPageCount()
354 354
 	{
355
-		return $this->getViewState('PageCount',0);
355
+		return $this->getViewState('PageCount', 0);
356 356
 	}
357 357
 
358 358
 	/**
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	protected function setPageCount($value)
363 363
 	{
364
-		if(($value=TPropertyValue::ensureInteger($value))<0)
364
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
365 365
 			throw new TInvalidDataValueException('pager_pagecount_invalid');
366
-		$this->setViewState('PageCount',$value,0);
366
+		$this->setViewState('PageCount', $value, 0);
367 367
 	}
368 368
 
369 369
 	/**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	public function getIsLastPage()
381 381
 	{
382
-		return $this->getCurrentPageIndex()===$this->getPageCount()-1;
382
+		return $this->getCurrentPageIndex()===$this->getPageCount() - 1;
383 383
 	}
384 384
 
385 385
 	/**
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 
395 395
 		$controlID=$this->getControlToPaginate();
396 396
 		if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl))
397
-			throw new TConfigurationException('pager_controltopaginate_invalid',$controlID);
397
+			throw new TConfigurationException('pager_controltopaginate_invalid', $controlID);
398 398
 
399 399
 		if($targetControl->getAllowPaging())
400 400
 		{
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	public function render($writer)
418 418
 	{
419
-		if($this->_pageCount>1)
419
+		if($this->_pageCount > 1)
420 420
 			parent::render($writer);
421 421
 	}
422 422
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
454 454
 	 * @return mixed the button instance
455 455
 	 */
456
-	protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
456
+	protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
457 457
 	{
458 458
 		if($buttonType===TPagerButtonType::LinkButton)
459 459
 		{
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			if($buttonType===TPagerButtonType::ImageButton)
473 473
 			{
474 474
 				$button=new TImageButton;
475
-				$button->setImageUrl($this->getPageImageUrl($text,$commandName));
475
+				$button->setImageUrl($this->getPageImageUrl($text, $commandName));
476 476
 			}
477 477
 			else
478 478
 				$button=new TButton;
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
 	 * @param string the command name associated with the image button
493 493
 	 * @since 3.1.1
494 494
 	 */
495
-	protected function getPageImageUrl($text,$commandName)
495
+	protected function getPageImageUrl($text, $commandName)
496 496
 	{
497 497
 		switch($commandName)
498 498
 		{
499 499
 			case self::CMD_PAGE:
500 500
 				$url=$this->getNumericPageImageUrl();
501
-				return str_replace('{0}',$text,$url);
501
+				return str_replace('{0}', $text, $url);
502 502
 			case self::CMD_PAGE_NEXT:
503 503
 				return $this->getNextPageImageUrl();
504 504
 			case self::CMD_PAGE_PREV:
@@ -523,44 +523,44 @@  discard block
 block discarded – undo
523 523
 		{
524 524
 			if(($text=$this->getFirstPageText())!=='')
525 525
 			{
526
-				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_FIRST,'');
526
+				$label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_FIRST, '');
527 527
 				$controls->add($label);
528 528
 				$controls->add("\n");
529 529
 			}
530
-			$label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
530
+			$label=$this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, '');
531 531
 			$controls->add($label);
532 532
 		}
533 533
 		else
534 534
 		{
535 535
 			if(($text=$this->getFirstPageText())!=='')
536 536
 			{
537
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,'');
537
+				$button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, '');
538 538
 				$controls->add($button);
539 539
 				$controls->add("\n");
540 540
 			}
541
-			$button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
541
+			$button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE_PREV, '');
542 542
 			$controls->add($button);
543 543
 		}
544 544
 		$controls->add("\n");
545 545
 		if($this->getIsLastPage())
546 546
 		{
547
-			$label=$this->createPagerButton($buttonType,false,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
547
+			$label=$this->createPagerButton($buttonType, false, $this->getNextPageText(), self::CMD_PAGE_NEXT, '');
548 548
 			$controls->add($label);
549 549
 			if(($text=$this->getLastPageText())!=='')
550 550
 			{
551 551
 				$controls->add("\n");
552
-				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,'');
552
+				$label=$this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, '');
553 553
 				$controls->add($label);
554 554
 			}
555 555
 		}
556 556
 		else
557 557
 		{
558
-			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
558
+			$button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, '');
559 559
 			$controls->add($button);
560 560
 			if(($text=$this->getLastPageText())!=='')
561 561
 			{
562 562
 				$controls->add("\n");
563
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,'');
563
+				$button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, '');
564 564
 				$controls->add($button);
565 565
 			}
566 566
 		}
@@ -574,63 +574,63 @@  discard block
 block discarded – undo
574 574
 		$buttonType=$this->getButtonType();
575 575
 		$controls=$this->getControls();
576 576
 		$pageCount=$this->getPageCount();
577
-		$pageIndex=$this->getCurrentPageIndex()+1;
577
+		$pageIndex=$this->getCurrentPageIndex() + 1;
578 578
 		$maxButtonCount=$this->getPageButtonCount();
579
-		$buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount;
579
+		$buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount;
580 580
 		$startPageIndex=1;
581 581
 		$endPageIndex=$buttonCount;
582
-		if($pageIndex>$endPageIndex)
582
+		if($pageIndex > $endPageIndex)
583 583
 		{
584
-			$startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1;
585
-			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
584
+			$startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1;
585
+			if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount)
586 586
 				$endPageIndex=$pageCount;
587
-			if($endPageIndex-$startPageIndex+1<$maxButtonCount)
587
+			if($endPageIndex - $startPageIndex + 1 < $maxButtonCount)
588 588
 			{
589
-				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
589
+				if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1)
590 590
 					$startPageIndex=1;
591 591
 			}
592 592
 		}
593 593
 
594
-		if($startPageIndex>1)
594
+		if($startPageIndex > 1)
595 595
 		{
596 596
 			if(($text=$this->getFirstPageText())!=='')
597 597
 			{
598
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,'');
598
+				$button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, '');
599 599
 				$controls->add($button);
600 600
 				$controls->add("\n");
601 601
 			}
602
-			$prevPageIndex=$startPageIndex-1;
603
-			$button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex");
602
+			$prevPageIndex=$startPageIndex - 1;
603
+			$button=$this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex");
604 604
 			$controls->add($button);
605 605
 			$controls->add("\n");
606 606
 		}
607 607
 
608
-		for($i=$startPageIndex;$i<=$endPageIndex;++$i)
608
+		for($i=$startPageIndex; $i <= $endPageIndex; ++$i)
609 609
 		{
610 610
 			if($i===$pageIndex)
611 611
 			{
612
-				$label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,'');
612
+				$label=$this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, '');
613 613
 				$controls->add($label);
614 614
 			}
615 615
 			else
616 616
 			{
617
-				$button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i");
617
+				$button=$this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i");
618 618
 				$controls->add($button);
619 619
 			}
620
-			if($i<$endPageIndex)
620
+			if($i < $endPageIndex)
621 621
 				$controls->add("\n");
622 622
 		}
623 623
 
624
-		if($pageCount>$endPageIndex)
624
+		if($pageCount > $endPageIndex)
625 625
 		{
626 626
 			$controls->add("\n");
627
-			$nextPageIndex=$endPageIndex+1;
628
-			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE,"$nextPageIndex");
627
+			$nextPageIndex=$endPageIndex + 1;
628
+			$button=$this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE, "$nextPageIndex");
629 629
 			$controls->add($button);
630 630
 			if(($text=$this->getLastPageText())!=='')
631 631
 			{
632 632
 				$controls->add("\n");
633
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,'');
633
+				$button=$this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, '');
634 634
 				$controls->add($button);
635 635
 			}
636 636
 		}
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
 	{
644 644
 		$list=new TDropDownList;
645 645
 		$this->getControls()->add($list);
646
-		$list->setDataSource(range(1,$this->getPageCount()));
646
+		$list->setDataSource(range(1, $this->getPageCount()));
647 647
 		$list->dataBind();
648 648
 		$list->setSelectedIndex($this->getCurrentPageIndex());
649 649
 		$list->setAutoPostBack(true);
650
-		$list->attachEventHandler('OnSelectedIndexChanged',array($this,'listIndexChanged'));
650
+		$list->attachEventHandler('OnSelectedIndexChanged', array($this, 'listIndexChanged'));
651 651
 	}
652 652
 
653 653
 	/**
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
 	 * @param TDropDownList the dropdown list control raising the event
657 657
 	 * @param TEventParameter event parameter
658 658
 	 */
659
-	public function listIndexChanged($sender,$param)
659
+	public function listIndexChanged($sender, $param)
660 660
 	{
661 661
 		$pageIndex=$sender->getSelectedIndex();
662
-		$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
662
+		$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
663 663
 	}
664 664
 
665 665
 	/**
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 */
669 669
 	public function onPageIndexChanged($param)
670 670
 	{
671
-		$this->raiseEvent('OnPageIndexChanged',$this,$param);
671
+		$this->raiseEvent('OnPageIndexChanged', $this, $param);
672 672
 	}
673 673
 
674 674
 	/**
@@ -679,37 +679,37 @@  discard block
 block discarded – undo
679 679
 	 * @param TEventParameter event parameter
680 680
 	 * @return boolean whether the event bubbling should stop here.
681 681
 	 */
682
-	public function bubbleEvent($sender,$param)
682
+	public function bubbleEvent($sender, $param)
683 683
 	{
684 684
 		if($param instanceof \Prado\Web\UI\TCommandEventParameter)
685 685
 		{
686 686
 			$command=$param->getCommandName();
687
-			if(strcasecmp($command,self::CMD_PAGE)===0)
687
+			if(strcasecmp($command, self::CMD_PAGE)===0)
688 688
 			{
689
-				$pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1;
690
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
689
+				$pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter()) - 1;
690
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
691 691
 				return true;
692 692
 			}
693
-			else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
693
+			else if(strcasecmp($command, self::CMD_PAGE_NEXT)===0)
694 694
 			{
695
-				$pageIndex=$this->getCurrentPageIndex()+1;
696
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
695
+				$pageIndex=$this->getCurrentPageIndex() + 1;
696
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
697 697
 				return true;
698 698
 			}
699
-			else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
699
+			else if(strcasecmp($command, self::CMD_PAGE_PREV)===0)
700 700
 			{
701
-				$pageIndex=$this->getCurrentPageIndex()-1;
702
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
701
+				$pageIndex=$this->getCurrentPageIndex() - 1;
702
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
703 703
 				return true;
704 704
 			}
705
-			else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
705
+			else if(strcasecmp($command, self::CMD_PAGE_FIRST)===0)
706 706
 			{
707
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0));
707
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0));
708 708
 				return true;
709 709
 			}
710
-			else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
710
+			else if(strcasecmp($command, self::CMD_PAGE_LAST)===0)
711 711
 			{
712
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1));
712
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1));
713 713
 				return true;
714 714
 			}
715 715
 			return false;
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -403,8 +403,7 @@  discard block
 block discarded – undo
403 403
 			$this->setPageCount($targetControl->getPageCount());
404 404
 			$this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
405 405
 			$this->buildPager();
406
-		}
407
-		else
406
+		} else
408 407
 			$this->_pageCount=0;
409 408
 	}
410 409
 
@@ -466,15 +465,13 @@  discard block
 block discarded – undo
466 465
 				$button->setCssClass($this->getButtonCssClass());
467 466
 				return $button;
468 467
 			}
469
-		}
470
-		else
468
+		} else
471 469
 		{
472 470
 			if($buttonType===TPagerButtonType::ImageButton)
473 471
 			{
474 472
 				$button=new TImageButton;
475 473
 				$button->setImageUrl($this->getPageImageUrl($text,$commandName));
476
-			}
477
-			else
474
+			} else
478 475
 				$button=new TButton;
479 476
 			if(!$enabled)
480 477
 				$button->setEnabled(false);
@@ -529,8 +526,7 @@  discard block
 block discarded – undo
529 526
 			}
530 527
 			$label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
531 528
 			$controls->add($label);
532
-		}
533
-		else
529
+		} else
534 530
 		{
535 531
 			if(($text=$this->getFirstPageText())!=='')
536 532
 			{
@@ -552,8 +548,7 @@  discard block
 block discarded – undo
552 548
 				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,'');
553 549
 				$controls->add($label);
554 550
 			}
555
-		}
556
-		else
551
+		} else
557 552
 		{
558 553
 			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
559 554
 			$controls->add($button);
@@ -611,8 +606,7 @@  discard block
 block discarded – undo
611 606
 			{
612 607
 				$label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,'');
613 608
 				$controls->add($label);
614
-			}
615
-			else
609
+			} else
616 610
 			{
617 611
 				$button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i");
618 612
 				$controls->add($button);
@@ -689,32 +683,27 @@  discard block
 block discarded – undo
689 683
 				$pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1;
690 684
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
691 685
 				return true;
692
-			}
693
-			else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
686
+			} else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
694 687
 			{
695 688
 				$pageIndex=$this->getCurrentPageIndex()+1;
696 689
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
697 690
 				return true;
698
-			}
699
-			else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
691
+			} else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
700 692
 			{
701 693
 				$pageIndex=$this->getCurrentPageIndex()-1;
702 694
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
703 695
 				return true;
704
-			}
705
-			else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
696
+			} else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
706 697
 			{
707 698
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0));
708 699
 				return true;
709
-			}
710
-			else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
700
+			} else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
711 701
 			{
712 702
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1));
713 703
 				return true;
714 704
 			}
715 705
 			return false;
716
-		}
717
-		else
706
+		} else
718 707
 			return false;
719 708
 	}
720 709
 }
721 710
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRangeValidator.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -96,6 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 	/**
98 98
 	 * @param boolean true to perform strict comparison (i.e. strictly less than max and/or strictly greater than min).
99
+	 * @param boolean $value
99 100
 	 */
100 101
 	public function setStrictComparison($value)
101 102
 	{
@@ -191,6 +192,7 @@  discard block
 block discarded – undo
191 192
 	/**
192 193
 	* Determine if the value is within the integer range.
193 194
 	* @param string value to validate true
195
+	* @param string $value
194 196
 	* @return boolean true if within integer range.
195 197
 	*/
196 198
 	protected function isValidInteger($value)
@@ -220,6 +222,7 @@  discard block
 block discarded – undo
220 222
 	/**
221 223
 	 * Determine if the value is within the specified float range.
222 224
 	 * @param string value to validate
225
+	 * @param string $value
223 226
 	 * @return boolean true if within range.
224 227
 	 */
225 228
 	protected function isValidFloat($value)
@@ -240,6 +243,7 @@  discard block
 block discarded – undo
240 243
 	 * Determine if the date is within the specified range.
241 244
 	 * Uses pradoParseDate and strtotime to get the date from string.
242 245
 	 * @param string date as string to validate
246
+	 * @param string $value
243 247
 	 * @return boolean true if within range.
244 248
 	 */
245 249
 	protected function isValidDate($value)
@@ -275,6 +279,7 @@  discard block
 block discarded – undo
275 279
 	 * Compare the string with a minimum and a maxiumum value.
276 280
 	 * Uses strcmp for comparision.
277 281
 	 * @param string value to compare with.
282
+	 * @param string $value
278 283
 	 * @return boolean true if the string is within range.
279 284
 	 */
280 285
 	protected function isValidString($value)
@@ -292,6 +297,7 @@  discard block
 block discarded – undo
292 297
 
293 298
 	/**
294 299
 	 * @param string string for comparision
300
+	 * @param string $value
295 301
 	 * @return boolean true if min and max string length are satisfied.
296 302
 	 */
297 303
 	protected function isValidStringLength($value)
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-     * Sets the date format for a date validation
133
-     * @param string the date format value
134
-     */
132
+	 * Sets the date format for a date validation
133
+	 * @param string the date format value
134
+	 */
135 135
 	public function setDateFormat($value)
136 136
 	{
137 137
 		$this->setViewState('DateFormat', $value, '');
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Determine if the value is within the integer range.
193
-	* @param string value to validate true
194
-	* @return boolean true if within integer range.
195
-	*/
192
+	 * Determine if the value is within the integer range.
193
+	 * @param string value to validate true
194
+	 * @return boolean true if within integer range.
195
+	 */
196 196
 	protected function isValidInteger($value)
197 197
 	{
198 198
 		$minValue=$this->getMinValue();
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function getMinValue()
67 67
 	{
68
-		return $this->getViewState('MinValue','');
68
+		return $this->getViewState('MinValue', '');
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function setMinValue($value)
76 76
 	{
77
-		$this->setViewState('MinValue',TPropertyValue::ensureString($value),'');
77
+		$this->setViewState('MinValue', TPropertyValue::ensureString($value), '');
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getMaxValue()
84 84
 	{
85
-		return $this->getViewState('MaxValue','');
85
+		return $this->getViewState('MaxValue', '');
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setMaxValue($value)
93 93
 	{
94
-		$this->setViewState('MaxValue',TPropertyValue::ensureString($value),'');
94
+		$this->setViewState('MaxValue', TPropertyValue::ensureString($value), '');
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function setStrictComparison($value)
101 101
 	{
102
-		$this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value),false);
102
+		$this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value), false);
103 103
 	}
104 104
 
105 105
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getDataType()
118 118
 	{
119
-		return $this->getViewState('DataType',TRangeValidationDataType::String);
119
+		return $this->getViewState('DataType', TRangeValidationDataType::String);
120 120
 	}
121 121
 
122 122
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function setDataType($value)
127 127
 	{
128
-		$this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'),TRangeValidationDataType::String);
128
+		$this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'), TRangeValidationDataType::String);
129 129
 	}
130 130
 
131 131
 	/**
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 		$minValue=$this->getMinValue();
199 199
 		$maxValue=$this->getMaxValue();
200 200
 
201
-		$valid=preg_match('/^[-+]?[0-9]+$/',trim($value));
201
+		$valid=preg_match('/^[-+]?[0-9]+$/', trim($value));
202 202
 		$value=intval($value);
203 203
 		if($minValue!=='')
204 204
 			$valid=$valid && $this->isGreaterThan($value, intval($minValue));
205 205
 		if($maxValue!=='')
206
-			$valid=$valid && $this->isLessThan($value,intval($maxValue));
206
+			$valid=$valid && $this->isLessThan($value, intval($maxValue));
207 207
 		return $valid;
208 208
 	}
209 209
 
210
-	protected function isLessThan($left,$right)
210
+	protected function isLessThan($left, $right)
211 211
 	{
212 212
 		return $this->getStrictComparison() ? $left < $right : $left <= $right;
213 213
 	}
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 		$minValue=$this->getMinValue();
228 228
 		$maxValue=$this->getMaxValue();
229 229
 
230
-		$valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
230
+		$valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value));
231 231
 		$value=floatval($value);
232 232
 		if($minValue!=='')
233
-			$valid=$valid && $this->isGreaterThan($value,floatval($minValue));
233
+			$valid=$valid && $this->isGreaterThan($value, floatval($minValue));
234 234
 		if($maxValue!=='')
235
-			$valid=$valid && $this->isLessThan($value,floatval($maxValue));
235
+			$valid=$valid && $this->isLessThan($value, floatval($maxValue));
236 236
 		return $valid;
237 237
 	}
238 238
 
@@ -249,24 +249,24 @@  discard block
 block discarded – undo
249 249
 
250 250
 		$valid=true;
251 251
 
252
-		$dateFormat = $this->getDateFormat();
252
+		$dateFormat=$this->getDateFormat();
253 253
 		if($dateFormat!=='')
254 254
 		{
255
-			$formatter= new TSimpleDateFormatter($dateFormat);
256
-			$value = $formatter->parse($value);
255
+			$formatter=new TSimpleDateFormatter($dateFormat);
256
+			$value=$formatter->parse($value);
257 257
 			if($minValue!=='')
258
-				$valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue));
258
+				$valid=$valid && $this->isGreaterThan($value, $formatter->parse($minValue));
259 259
 			if($maxValue!=='')
260
-				$valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue));
260
+				$valid=$valid && $this->isLessThan($value, $formatter->parse($maxValue));
261 261
 			return $valid;
262 262
 		}
263 263
 		else
264 264
 		{
265 265
 			$value=strtotime($value);
266 266
 			if($minValue!=='')
267
-				$valid=$valid && $this->isGreaterThan($value,strtotime($minValue));
267
+				$valid=$valid && $this->isGreaterThan($value, strtotime($minValue));
268 268
 			if($maxValue!=='')
269
-				$valid=$valid && $this->isLessThan($value,strtotime($maxValue));
269
+				$valid=$valid && $this->isLessThan($value, strtotime($maxValue));
270 270
 			return $valid;
271 271
 		}
272 272
 	}
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
 
285 285
 		$valid=true;
286 286
 		if($minValue!=='')
287
-			$valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0);
287
+			$valid=$valid && $this->isGreaterThan(strcmp($value, $minValue), 0);
288 288
 		if($maxValue!=='')
289
-			$valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0);
289
+			$valid=$valid && $this->isLessThan(strcmp($value, $maxValue), 0);
290 290
 		return $valid;
291 291
 	}
292 292
 
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
 		$maxValue=$this->getMaxValue();
301 301
 
302 302
 		$valid=true;
303
-		$charset = $this->getCharset();
303
+		$charset=$this->getCharset();
304 304
 		if($charset==='')
305 305
 		{
306
-			$app= $this->getApplication()->getGlobalization();
307
-			$charset = $app ? $app->getCharset() : null;
306
+			$app=$this->getApplication()->getGlobalization();
307
+			$charset=$app ? $app->getCharset() : null;
308 308
 			if(!$charset)
309
-				$charset = 'UTF-8';
309
+				$charset='UTF-8';
310 310
 		}
311 311
 
312
-		$length = iconv_strlen($value, $charset);
312
+		$length=iconv_strlen($value, $charset);
313 313
 		if($minValue!=='')
314
-			$valid = $valid && $this->isGreaterThan($length,intval($minValue));
314
+			$valid=$valid && $this->isGreaterThan($length, intval($minValue));
315 315
 		if($maxValue!=='')
316
-			$valid = $valid && $this->isLessThan($length,intval($maxValue));
316
+			$valid=$valid && $this->isLessThan($length, intval($maxValue));
317 317
 		return $valid;
318 318
 	}
319 319
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -259,8 +259,7 @@
 block discarded – undo
259 259
 			if($maxValue!=='')
260 260
 				$valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue));
261 261
 			return $valid;
262
-		}
263
-		else
262
+		} else
264 263
 		{
265 264
 			$value=strtotime($value);
266 265
 			if($minValue!=='')
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRatingList.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -132,6 +132,7 @@
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * @param float rating value
135
+	 * @param double $rating
135 136
 	 * @return int rating as integer
136 137
 	 */
137 138
 	protected function getRatingIndex($rating)
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
  	}
216 216
 
217 217
  	/**
218
-	 * @return string rating style css class name.
218
+ 	 * @return string rating style css class name.
219 219
  	 */
220 220
 	protected function getRatingStyleCssClass()
221 221
  	{
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  	}
259 259
 
260 260
  	/**
261
-	 * @return string find the client ID of the caption control.
261
+ 	 * @return string find the client ID of the caption control.
262 262
  	 */
263 263
 	protected function getCaptionControlID()
264 264
  	{
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * Script path relative to the TClientScriptManager::SCRIPT_PATH
30 30
 	 */
31
-	const SCRIPT_PATH = 'ratings';
31
+	const SCRIPT_PATH='ratings';
32 32
 
33 33
 	/**
34 34
 	 * @var array list of published rating images.
35 35
 	 */
36
-	private $_ratingImages = array();
36
+	private $_ratingImages=array();
37 37
 
38 38
 	/**
39 39
 	 * Sets the default repeat direction to horizontal.
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function getReadOnly()
51 51
 	{
52
-		return $this->getViewState('ReadOnly',false);
52
+		return $this->getViewState('ReadOnly', false);
53 53
 	}
54 54
 
55 55
 	/**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function setReadOnly($value)
59 59
 	{
60
-		$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
60
+		$this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
61 61
 	}
62 62
 
63 63
 	/**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getRating()
107 107
 	{
108
-		$rating = $this->getViewState('Rating', null);
109
-		if ($rating === null)
110
-			return $this->getSelectedIndex()+1;
108
+		$rating=$this->getViewState('Rating', null);
109
+		if($rating===null)
110
+			return $this->getSelectedIndex() + 1;
111 111
 		else
112 112
 			return $rating;
113 113
 	}
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function setRating($value)
119 119
 	{
120
-		$value = TPropertyValue::ensureFloat($value);
120
+		$value=TPropertyValue::ensureFloat($value);
121 121
 		$this->setViewState('Rating', $value, null);
122
-		$index = $this->getRatingIndex($value);
122
+		$index=$this->getRatingIndex($value);
123 123
 		parent::setSelectedIndex($index);
124 124
 	}
125 125
 
126 126
 	public function setSelectedIndex($value)
127 127
 	{
128
-		$this->setRating($value+1);
128
+		$this->setRating($value + 1);
129 129
 		parent::setSelectedIndex($value);
130 130
 	}
131 131
 
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function getRatingIndex($rating)
137 137
 	{
138
-		$interval = $this->getHalfRatingInterval();
139
-		$base = intval($rating)-1;
140
-		$remainder = $rating-$base-1;
141
-		return $remainder > $interval[1] ? $base+1 : $base;
138
+		$interval=$this->getHalfRatingInterval();
139
+		$base=intval($rating) - 1;
140
+		$remainder=$rating - $base - 1;
141
+		return $remainder > $interval[1] ? $base + 1 : $base;
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function onSelectedIndexChanged($param)
148 148
 	{
149
-		$value = $this->getRating();
150
-		$value = TPropertyValue::ensureInteger($value);
149
+		$value=$this->getRating();
150
+		$value=TPropertyValue::ensureInteger($value);
151 151
 		$this->setRating($value);
152 152
 		parent::onSelectedIndexChanged($param);
153 153
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				return $control;
179 179
 		}
180 180
 		throw new TInvalidDataValueException(
181
-			'ratinglist_invalid_caption_id',$id,$this->getID());
181
+			'ratinglist_invalid_caption_id', $id, $this->getID());
182 182
 	}
183 183
 
184 184
 	/**
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	protected function getPostBackOptions()
247 247
  	{
248
-		$options = parent::getPostBackOptions();
249
-		$options['AutoPostBack'] = $this->getAutoPostBack();
250
-		$options['ReadOnly'] = $this->getReadOnly();
251
-		$options['Style'] = $this->getRatingStyleCssClass();
252
-		$options['CaptionID'] = $this->getCaptionControlID();
253
-		$options['SelectedIndex'] = $this->getSelectedIndex();
254
-		$options['Rating'] = $this->getRating();
255
-		$options['HalfRating'] = $this->getHalfRatingInterval();
248
+		$options=parent::getPostBackOptions();
249
+		$options['AutoPostBack']=$this->getAutoPostBack();
250
+		$options['ReadOnly']=$this->getReadOnly();
251
+		$options['Style']=$this->getRatingStyleCssClass();
252
+		$options['CaptionID']=$this->getCaptionControlID();
253
+		$options['SelectedIndex']=$this->getSelectedIndex();
254
+		$options['Rating']=$this->getRating();
255
+		$options['HalfRating']=$this->getHalfRatingInterval();
256 256
 		return $options;
257 257
  	}
258 258
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
  	{
282 282
 		parent::onPreRender($param);
283 283
 		$this->publishStyle($this->getRatingStyle());
284
-		$this->_ratingImages = $this->publishImages($this->getRatingStyle());
284
+		$this->_ratingImages=$this->publishImages($this->getRatingStyle());
285 285
  		$this->registerClientScript();
286 286
 	}
287 287
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	protected function publishStyle($style)
293 293
  	{
294
-		$cs = $this->getPage()->getClientScript();
295
-		$url = $this->getAssetUrl($style.'.css');
294
+		$cs=$this->getPage()->getClientScript();
295
+		$url=$this->getAssetUrl($style.'.css');
296 296
 		if(!$cs->isStyleSheetFileRegistered($url))
297 297
 			$cs->registerStyleSheetFile($url, $url);
298 298
 		return $url;
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	protected function publishImages($style, $fileExt='.gif')
307 307
  	{
308
-		$types = array('blank', 'selected', 'half', 'combined');
309
-		$files = array();
308
+		$types=array('blank', 'selected', 'half', 'combined');
309
+		$files=array();
310 310
 		foreach($types as $type)
311
-			$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
311
+			$files[$type]=$this->getAssetUrl("{$style}_{$type}{$fileExt}");
312 312
 		return $files;
313 313
  	}
314 314
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	protected function getAssetUrl($file='')
329 329
  	{
330
-		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
330
+		$base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl();
331 331
 		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
332 332
  	}
333 333
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function render($writer)
341 341
  	{
342
-		$writer->addAttribute('id',$this->getClientID());
342
+		$writer->addAttribute('id', $this->getClientID());
343 343
 		$this->getPage()->getClientScript()->registerPostBackControl(
344 344
 			$this->getClientClassName(), $this->getPostBackOptions());
345 345
 		parent::render($writer);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -267,8 +267,7 @@
 block discarded – undo
267 267
 			{
268 268
 				if($control->getVisible(true))
269 269
 					return $control->getClientID();
270
-			}
271
-			else
270
+			} else
272 271
 				return $id;
273 272
  		}
274 273
 		return '';
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTable.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -144,6 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	/**
146 146
 	 * @param string table caption
147
+	 * @param string $value
147 148
 	 */
148 149
 	public function setCaption($value)
149 150
 	{
@@ -160,6 +161,7 @@  discard block
 block discarded – undo
160 161
 
161 162
 	/**
162 163
 	 * @param TTableCaptionAlign table caption alignment.
164
+	 * @param TTableCaptionAlign $value
163 165
 	 */
164 166
 	public function setCaptionAlign($value)
165 167
 	{
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -306,8 +306,7 @@  discard block
 block discarded – undo
306 306
 					{
307 307
 						if($index===0 && $currentSection===TTableRowSection::Header)
308 308
 							$writer->renderBeginTag('thead');
309
-					}
310
-					else
309
+					} else
311 310
 					{
312 311
 						if($currentSection===TTableRowSection::Header)
313 312
 						{
@@ -318,8 +317,7 @@  discard block
 block discarded – undo
318 317
 							else
319 318
 								$writer->renderBeginTag('tfoot');
320 319
 							$currentSection=$section;
321
-						}
322
-						else if($currentSection===TTableRowSection::Body)
320
+						} else if($currentSection===TTableRowSection::Body)
323 321
 						{
324 322
 							$writer->renderEndTag();
325 323
 							if($section===TTableRowSection::Footer)
@@ -327,16 +325,14 @@  discard block
 block discarded – undo
327 325
 							else
328 326
 								throw new TConfigurationException('table_tablesection_outoforder');
329 327
 							$currentSection=$section;
330
-						}
331
-						else // Footer
328
+						} else // Footer
332 329
 							throw new TConfigurationException('table_tablesection_outoforder');
333 330
 					}
334 331
 					$row->renderControl($writer);
335 332
 					$writer->writeLine();
336 333
 				}
337 334
 				$writer->renderEndTag();
338
-			}
339
-			else
335
+			} else
340 336
 			{
341 337
 				$writer->writeLine();
342 338
 				foreach($this->getControls() as $row)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				if(($border=$this->getBorderWidth())==='')
110 110
 					$border=1;
111 111
 				else
112
-					$border=(int)$border;
112
+					$border=(int) $border;
113 113
 			}
114 114
 		}
115
-		$writer->addAttribute('border',"$border");
115
+		$writer->addAttribute('border', "$border");
116 116
 	}
117 117
 
118 118
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function getCaption()
140 140
 	{
141
-		return $this->getViewState('Caption','');
141
+		return $this->getViewState('Caption', '');
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function setCaption($value)
148 148
 	{
149
-		$this->setViewState('Caption',$value,'');
149
+		$this->setViewState('Caption', $value, '');
150 150
 	}
151 151
 
152 152
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function getCaptionAlign()
156 156
 	{
157
-		return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet);
157
+		return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet);
158 158
 	}
159 159
 
160 160
 	/**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function setCaptionAlign($value)
164 164
 	{
165
-		$this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'),TTableCaptionAlign::NotSet);
165
+		$this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TTableCaptionAlign'), TTableCaptionAlign::NotSet);
166 166
 	}
167 167
 
168 168
 	/**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		if(($caption=$this->getCaption())!=='')
272 272
 		{
273 273
 			if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
274
-				$writer->addAttribute('align',strtolower($align));
274
+				$writer->addAttribute('align', strtolower($align));
275 275
 			$writer->renderBeginTag('caption');
276 276
 			$writer->write($caption);
277 277
 			$writer->renderEndTag();
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 					{
311 311
 						if($currentSection===TTableRowSection::Header)
312 312
 						{
313
-							if($index>0)
313
+							if($index > 0)
314 314
 								$writer->renderEndTag();
315 315
 							if($section===TTableRowSection::Body)
316 316
 								$writer->renderBeginTag('tbody');
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTemplateColumn.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	/**
121
-	 * @return ITemplate the item template
121
+	 * @return string the item template
122 122
 	 */
123 123
 	public function getItemTemplate()
124 124
 	{
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getItemRenderer()
55 55
 	{
56
-		return $this->getViewState('ItemRenderer','');
56
+		return $this->getViewState('ItemRenderer', '');
57 57
 	}
58 58
 
59 59
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setItemRenderer($value)
71 71
 	{
72
-		$this->setViewState('ItemRenderer',$value,'');
72
+		$this->setViewState('ItemRenderer', $value, '');
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function getEditItemRenderer()
80 80
 	{
81
-		return $this->getViewState('EditItemRenderer','');
81
+		return $this->getViewState('EditItemRenderer', '');
82 82
 	}
83 83
 
84 84
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setEditItemRenderer($value)
96 96
 	{
97
-		$this->setViewState('EditItemRenderer',$value,'');
97
+		$this->setViewState('EditItemRenderer', $value, '');
98 98
 	}
99 99
 
100 100
 	/**
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		if($value instanceof ITemplate || $value===null)
115 115
 			$this->_editItemTemplate=$value;
116 116
 		else
117
-			throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
117
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate');
118 118
 	}
119 119
 
120 120
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		if($value instanceof ITemplate || $value===null)
135 135
 			$this->_itemTemplate=$value;
136 136
 		else
137
-			throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
137
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate');
138 138
 	}
139 139
 
140 140
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		if($value instanceof ITemplate || $value===null)
155 155
 			$this->_headerTemplate=$value;
156 156
 		else
157
-			throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
157
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate');
158 158
 	}
159 159
 
160 160
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		if($value instanceof ITemplate || $value===null)
175 175
 			$this->_footerTemplate=$value;
176 176
 		else
177
-			throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
177
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate');
178 178
 	}
179 179
 
180 180
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @param integer the index to the Columns property that the cell resides in.
187 187
 	 * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
188 188
 	 */
189
-	public function initializeCell($cell,$columnIndex,$itemType)
189
+	public function initializeCell($cell, $columnIndex, $itemType)
190 190
 	{
191 191
 		if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem)
192 192
 		{
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 					$control->setItemType($itemType);
214 214
 				}
215 215
 				if($control instanceof \Prado\IDataRenderer)
216
-					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
216
+					$control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
217 217
 			}
218 218
 			else if($template!==null)
219 219
 				$template->instantiateIn($cell);
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 		else if($itemType===TListItemType::Header)
224 224
 		{
225 225
 			if(($classPath=$this->getHeaderRenderer())!=='')
226
-				$this->initializeHeaderCell($cell,$columnIndex);
226
+				$this->initializeHeaderCell($cell, $columnIndex);
227 227
 			else if($this->_headerTemplate!==null)
228 228
 				$this->_headerTemplate->instantiateIn($cell);
229 229
 			else
230
-				$this->initializeHeaderCell($cell,$columnIndex);
230
+				$this->initializeHeaderCell($cell, $columnIndex);
231 231
 		}
232 232
 		else if($itemType===TListItemType::Footer)
233 233
 		{
234 234
 			if(($classPath=$this->getFooterRenderer())!=='')
235
-				$this->initializeFooterCell($cell,$columnIndex);
235
+				$this->initializeFooterCell($cell, $columnIndex);
236 236
 			else if($this->_footerTemplate!==null)
237 237
 				$this->_footerTemplate->instantiateIn($cell);
238 238
 			else
239
-				$this->initializeFooterCell($cell,$columnIndex);
239
+				$this->initializeFooterCell($cell, $columnIndex);
240 240
 		}
241 241
 	}
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * This method is invoked when datagrid performs databinding.
246 246
 	 * It populates the content of the cell with the relevant data from data source.
247 247
 	 */
248
-	public function dataBindColumn($sender,$param)
248
+	public function dataBindColumn($sender, $param)
249 249
 	{
250 250
 		$item=$sender->getNamingContainer();
251 251
 		$sender->setData($item->getData());
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 					$classPath=$this->getItemRenderer();
198 198
 					$template=$this->_itemTemplate;
199 199
 				}
200
-			}
201
-			else
200
+			} else
202 201
 			{
203 202
 				$template=$this->_itemTemplate;
204 203
 				$classPath=$this->getItemRenderer();
@@ -214,13 +213,11 @@  discard block
 block discarded – undo
214 213
 				}
215 214
 				if($control instanceof \Prado\IDataRenderer)
216 215
 					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
217
-			}
218
-			else if($template!==null)
216
+			} else if($template!==null)
219 217
 				$template->instantiateIn($cell);
220 218
 			else if($itemType!==TListItemType::EditItem)
221 219
 				$cell->setText('&nbsp;');
222
-		}
223
-		else if($itemType===TListItemType::Header)
220
+		} else if($itemType===TListItemType::Header)
224 221
 		{
225 222
 			if(($classPath=$this->getHeaderRenderer())!=='')
226 223
 				$this->initializeHeaderCell($cell,$columnIndex);
@@ -228,8 +225,7 @@  discard block
 block discarded – undo
228 225
 				$this->_headerTemplate->instantiateIn($cell);
229 226
 			else
230 227
 				$this->initializeHeaderCell($cell,$columnIndex);
231
-		}
232
-		else if($itemType===TListItemType::Footer)
228
+		} else if($itemType===TListItemType::Footer)
233 229
 		{
234 230
 			if(($classPath=$this->getFooterRenderer())!=='')
235 231
 				$this->initializeFooterCell($cell,$columnIndex);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -113,6 +113,7 @@
 block discarded – undo
113 113
 
114 114
 	/**
115 115
 	 * @param string button caption
116
+	 * @param string $value
116 117
 	 */
117 118
 	public function setButtonText($value)
118 119
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function getImageUrl()
91 91
 	{
92
-		return $this->_imageUrl===null?'':$this->_imageUrl;
92
+		return $this->_imageUrl===null ? '' : $this->_imageUrl;
93 93
 	}
94 94
 
95 95
 	/**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getButtonText()
107 107
 	{
108
-		return $this->_buttonText===null?'':$this->_buttonText;
108
+		return $this->_buttonText===null ? '' : $this->_buttonText;
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getButtonType()
123 123
 	{
124
-		return $this->_buttonType===null? TWizardNavigationButtonType::Button :$this->_buttonType;
124
+		return $this->_buttonType===null ? TWizardNavigationButtonType::Button : $this->_buttonType;
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function setButtonType($value)
131 131
 	{
132
-		$this->_buttonType=TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType');
132
+		$this->_buttonType=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TWizardNavigationButtonType');
133 133
 	}
134 134
 
135 135
 	/**
Please login to merge, or discard this patch.
framework/Wsat/TWsatARGenerator.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -207,6 +207,10 @@
 block discarded – undo
207 207
                 return $code;
208 208
         }
209 209
 
210
+        /**
211
+         * @param string $classname
212
+         * @param string $toString
213
+         */
210 214
         protected function generateClass($properties, $tablename, $classname, $toString)
211 215
         {
212 216
                 $props = implode("\n", $properties);
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -14,206 +14,206 @@  discard block
 block discarded – undo
14 14
 class TWsatARGenerator extends TWsatBaseGenerator
15 15
 {
16 16
 
17
-        /**
18
-         * Class name prefix
19
-         */
20
-        private $_clasPrefix;
21
-
22
-        /**
23
-         * Class name sufix
24
-         */
25
-        private $_classSufix;
26
-
27
-        /**
28
-         * all table relations array
29
-         */
30
-        private $_relations;
31
-
32
-        /**
33
-         * unquote chars
34
-         * @var array
35
-         */
36
-        private $uqChars = array('[', ']', '"', '`', "'");
37
-
38
-        function __construct()
39
-        {
40
-                parent::__construct();
41
-        }
42
-
43
-        public function setClasPrefix($_clas_prefix)
44
-        {
45
-                $this->_clasPrefix = $_clas_prefix;
46
-        }
47
-
48
-        public function setClassSufix($_clas_sufix)
49
-        {
50
-                $this->_classSufix = $_clas_sufix;
51
-        }
17
+		/**
18
+		 * Class name prefix
19
+		 */
20
+		private $_clasPrefix;
21
+
22
+		/**
23
+		 * Class name sufix
24
+		 */
25
+		private $_classSufix;
26
+
27
+		/**
28
+		 * all table relations array
29
+		 */
30
+		private $_relations;
31
+
32
+		/**
33
+		 * unquote chars
34
+		 * @var array
35
+		 */
36
+		private $uqChars = array('[', ']', '"', '`', "'");
37
+
38
+		function __construct()
39
+		{
40
+				parent::__construct();
41
+		}
42
+
43
+		public function setClasPrefix($_clas_prefix)
44
+		{
45
+				$this->_clasPrefix = $_clas_prefix;
46
+		}
47
+
48
+		public function setClassSufix($_clas_sufix)
49
+		{
50
+				$this->_classSufix = $_clas_sufix;
51
+		}
52 52
 
53 53
 //-----------------------------------------------------------------------------
54
-        // <editor-fold defaultstate="collapsed" desc="Main APIs">
55
-        public function generate($tableName)
56
-        {
57
-                $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
-                $this->_commonGenerate($tableName, $tableInfo);
59
-        }
60
-
61
-        public function generateAll()
62
-        {
63
-                foreach ($this->getAllTableNames() as $tableName)
64
-                {
65
-                        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
-                        if (!empty($this->_relations))
67
-                        {
68
-                                // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
-                                        continue;
71
-                        }
72
-                        $this->_commonGenerate($tableName, $tableInfo);
73
-                }
74
-        }
75
-
76
-        public function buildRelations()
77
-        {
78
-                $this->_relations = array();
79
-                foreach ($this->getAllTableNames() as $table_name)
80
-                {
81
-                        $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
-                        $pks = $tableInfo->getPrimaryKeys();
83
-                        $fks = $tableInfo->getForeignKeys();
84
-
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
-                        {
87
-                                $table_name_mm = $fks[0]["table"];
88
-                                $table_name_mm2 = $fks[1]["table"];
89
-
90
-                                $this->_relations[$table_name_mm][] = array(
91
-                                        "prop_name" => strtolower($table_name_mm2),
92
-                                        "rel_type" => "self::MANY_TO_MANY",
93
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
-                                        "prop_ref" => $table_name
95
-                                );
96
-
97
-                                $this->_relations[$table_name_mm2][] = array(
98
-                                        "prop_name" => strtolower($table_name_mm),
99
-                                        "rel_type" => "self::MANY_TO_MANY",
100
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm),
101
-                                        "prop_ref" => $table_name
102
-                                );
103
-                                continue;
104
-                        }
105
-                        foreach ($fks as $fk_data)//1-M relationships
106
-                        {
107
-                                $owner_table = $fk_data["table"];
108
-                                $slave_table = $table_name;
109
-                                $fk_prop = key($fk_data["keys"]);
110
-
111
-                                $this->_relations[$owner_table][] = array(
112
-                                        "prop_name" => strtolower($slave_table),
113
-                                        "rel_type" => "self::HAS_MANY",
114
-                                        "ref_class_name" => $this->_getProperClassName($slave_table),
115
-                                        "prop_ref" => $fk_prop
116
-                                );
117
-
118
-                                $this->_relations[$slave_table][] = array(
119
-                                        "prop_name" => strtolower($owner_table),
120
-                                        "rel_type" => "self::BELONGS_TO",
121
-                                        "ref_class_name" => $this->_getProperClassName($owner_table),
122
-                                        "prop_ref" => $fk_prop
123
-                                );
124
-                        }
125
-                }
126
-        }
54
+		// <editor-fold defaultstate="collapsed" desc="Main APIs">
55
+		public function generate($tableName)
56
+		{
57
+				$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
+				$this->_commonGenerate($tableName, $tableInfo);
59
+		}
60
+
61
+		public function generateAll()
62
+		{
63
+				foreach ($this->getAllTableNames() as $tableName)
64
+				{
65
+						$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
+						if (!empty($this->_relations))
67
+						{
68
+								// Cancel generation of M-M relationships middle table
69
+								if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
+										continue;
71
+						}
72
+						$this->_commonGenerate($tableName, $tableInfo);
73
+				}
74
+		}
75
+
76
+		public function buildRelations()
77
+		{
78
+				$this->_relations = array();
79
+				foreach ($this->getAllTableNames() as $table_name)
80
+				{
81
+						$tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
+						$pks = $tableInfo->getPrimaryKeys();
83
+						$fks = $tableInfo->getForeignKeys();
84
+
85
+						if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
+						{
87
+								$table_name_mm = $fks[0]["table"];
88
+								$table_name_mm2 = $fks[1]["table"];
89
+
90
+								$this->_relations[$table_name_mm][] = array(
91
+										"prop_name" => strtolower($table_name_mm2),
92
+										"rel_type" => "self::MANY_TO_MANY",
93
+										"ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
+										"prop_ref" => $table_name
95
+								);
96
+
97
+								$this->_relations[$table_name_mm2][] = array(
98
+										"prop_name" => strtolower($table_name_mm),
99
+										"rel_type" => "self::MANY_TO_MANY",
100
+										"ref_class_name" => $this->_getProperClassName($table_name_mm),
101
+										"prop_ref" => $table_name
102
+								);
103
+								continue;
104
+						}
105
+						foreach ($fks as $fk_data)//1-M relationships
106
+						{
107
+								$owner_table = $fk_data["table"];
108
+								$slave_table = $table_name;
109
+								$fk_prop = key($fk_data["keys"]);
110
+
111
+								$this->_relations[$owner_table][] = array(
112
+										"prop_name" => strtolower($slave_table),
113
+										"rel_type" => "self::HAS_MANY",
114
+										"ref_class_name" => $this->_getProperClassName($slave_table),
115
+										"prop_ref" => $fk_prop
116
+								);
117
+
118
+								$this->_relations[$slave_table][] = array(
119
+										"prop_name" => strtolower($owner_table),
120
+										"rel_type" => "self::BELONGS_TO",
121
+										"ref_class_name" => $this->_getProperClassName($owner_table),
122
+										"prop_ref" => $fk_prop
123
+								);
124
+						}
125
+				}
126
+		}
127 127
 
128 128
 // </editor-fold>
129 129
 //-----------------------------------------------------------------------------
130
-        // <editor-fold defaultstate="collapsed" desc="Common Methods">
131
-
132
-        private function _commonGenerate($tableName, $tableInfo)
133
-        {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
-                else
137
-                {
138
-                        $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
141
-                        $toString = $this->_buildSmartToString($tableInfo);
142
-                }
143
-
144
-                $clasName = $this->_getProperClassName($tableName);
145
-                $class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
-                $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
-                file_put_contents($output, $class);
148
-        }
149
-
150
-        private function _getProperClassName($tableName)
151
-        {
152
-                $table_name_words = str_replace("_", " ", strtolower($tableName));
153
-                $final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
-                return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
-        }
130
+		// <editor-fold defaultstate="collapsed" desc="Common Methods">
131
+
132
+		private function _commonGenerate($tableName, $tableInfo)
133
+		{
134
+				if (count($tableInfo->getColumns()) === 0)
135
+						throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
+				else
137
+				{
138
+						$properties = array();
139
+						foreach ($tableInfo->getColumns() as $field => $metadata)
140
+								$properties[] = $this->generateProperty($field, $metadata);
141
+						$toString = $this->_buildSmartToString($tableInfo);
142
+				}
143
+
144
+				$clasName = $this->_getProperClassName($tableName);
145
+				$class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
+				$output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
+				file_put_contents($output, $class);
148
+		}
149
+
150
+		private function _getProperClassName($tableName)
151
+		{
152
+				$table_name_words = str_replace("_", " ", strtolower($tableName));
153
+				$final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
+				return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
+		}
156 156
 
157 157
 //-----------------------------------------------------------------------------
158 158
 
159
-        protected function generateProperty($field, $metadata)
160
-        {
161
-                $prop = '';
162
-                $name = '$' . $field;
163
-
164
-                /* TODO use in version 2.0 */
165
-                // $type = $column->getPHPType();
166
-
167
-                $prop .= "\tpublic $name;";
168
-                return $prop;
169
-        }
170
-
171
-        private function _renderRelations($tablename)
172
-        {
173
-                if (!isset($this->_relations[$tablename]))
174
-                        return "";
175
-
176
-                $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
-
180
-                $code = substr($code, 0, -1);
181
-                $code .= "\n\t);";
182
-                return $code;
183
-        }
184
-
185
-        private function _buildSmartToString($tableInfo)
186
-        {
187
-                $code = "\tpublic function __toString() {";
188
-                $property = "throw new THttpException(500, 'Not implemented yet.');";
189
-                try
190
-                {
191
-                        foreach ($tableInfo->getColumns() as $column)
192
-                        {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
-                                {
197
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
198
-                                        break;
199
-                                }
200
-                        }
201
-                } catch (Exception $ex)
202
-                {
203
-                        Prado::trace($ex->getMessage());
204
-                }
205
-                $code .= "\n\t\treturn \$this->$property;";
206
-                $code .= "\n\t}";
207
-                return $code;
208
-        }
209
-
210
-        protected function generateClass($properties, $tablename, $classname, $toString)
211
-        {
212
-                $props = implode("\n", $properties);
213
-                $relations = $this->_renderRelations($tablename);
214
-                $date = date('Y-m-d h:i:s');
215
-                $env_user = getenv("username");
216
-                return <<<EOD
159
+		protected function generateProperty($field, $metadata)
160
+		{
161
+				$prop = '';
162
+				$name = '$' . $field;
163
+
164
+				/* TODO use in version 2.0 */
165
+				// $type = $column->getPHPType();
166
+
167
+				$prop .= "\tpublic $name;";
168
+				return $prop;
169
+		}
170
+
171
+		private function _renderRelations($tablename)
172
+		{
173
+				if (!isset($this->_relations[$tablename]))
174
+						return "";
175
+
176
+				$code = "\tpublic static \$RELATIONS = array (";
177
+				foreach ($this->_relations[$tablename] as $rel_data)
178
+						$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
+
180
+				$code = substr($code, 0, -1);
181
+				$code .= "\n\t);";
182
+				return $code;
183
+		}
184
+
185
+		private function _buildSmartToString($tableInfo)
186
+		{
187
+				$code = "\tpublic function __toString() {";
188
+				$property = "throw new THttpException(500, 'Not implemented yet.');";
189
+				try
190
+				{
191
+						foreach ($tableInfo->getColumns() as $column)
192
+						{
193
+								if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
195
+								elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
+								{
197
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
198
+										break;
199
+								}
200
+						}
201
+				} catch (Exception $ex)
202
+				{
203
+						Prado::trace($ex->getMessage());
204
+				}
205
+				$code .= "\n\t\treturn \$this->$property;";
206
+				$code .= "\n\t}";
207
+				return $code;
208
+		}
209
+
210
+		protected function generateClass($properties, $tablename, $classname, $toString)
211
+		{
212
+				$props = implode("\n", $properties);
213
+				$relations = $this->_renderRelations($tablename);
214
+				$date = date('Y-m-d h:i:s');
215
+				$env_user = getenv("username");
216
+				return <<<EOD
217 217
 <?php
218 218
 /**
219 219
  * Auto generated by PRADO - WSAT on $date.
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 $toString
235 235
 }
236 236
 EOD;
237
-        }
237
+		}
238 238
 
239 239
 // </editor-fold>
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
          * unquote chars
34 34
          * @var array
35 35
          */
36
-        private $uqChars = array('[', ']', '"', '`', "'");
36
+        private $uqChars=array('[', ']', '"', '`', "'");
37 37
 
38 38
         function __construct()
39 39
         {
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
 
43 43
         public function setClasPrefix($_clas_prefix)
44 44
         {
45
-                $this->_clasPrefix = $_clas_prefix;
45
+                $this->_clasPrefix=$_clas_prefix;
46 46
         }
47 47
 
48 48
         public function setClassSufix($_clas_sufix)
49 49
         {
50
-                $this->_classSufix = $_clas_sufix;
50
+                $this->_classSufix=$_clas_sufix;
51 51
         }
52 52
 
53 53
 //-----------------------------------------------------------------------------
54 54
         // <editor-fold defaultstate="collapsed" desc="Main APIs">
55 55
         public function generate($tableName)
56 56
         {
57
-                $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
57
+                $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
58 58
                 $this->_commonGenerate($tableName, $tableInfo);
59 59
         }
60 60
 
61 61
         public function generateAll()
62 62
         {
63
-                foreach ($this->getAllTableNames() as $tableName)
63
+                foreach($this->getAllTableNames() as $tableName)
64 64
                 {
65
-                        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
-                        if (!empty($this->_relations))
65
+                        $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
66
+                        if(!empty($this->_relations))
67 67
                         {
68 68
                                 // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
69
+                                if(count($tableInfo->getPrimaryKeys())===2 && count($tableInfo->getColumns())===2)//M-M relationships
70 70
                                         continue;
71 71
                         }
72 72
                         $this->_commonGenerate($tableName, $tableInfo);
@@ -75,26 +75,26 @@  discard block
 block discarded – undo
75 75
 
76 76
         public function buildRelations()
77 77
         {
78
-                $this->_relations = array();
79
-                foreach ($this->getAllTableNames() as $table_name)
78
+                $this->_relations=array();
79
+                foreach($this->getAllTableNames() as $table_name)
80 80
                 {
81
-                        $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
-                        $pks = $tableInfo->getPrimaryKeys();
83
-                        $fks = $tableInfo->getForeignKeys();
81
+                        $tableInfo=$this->_dbMetaData->getTableInfo($table_name);
82
+                        $pks=$tableInfo->getPrimaryKeys();
83
+                        $fks=$tableInfo->getForeignKeys();
84 84
 
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
85
+                        if(count($pks)===2 && count($tableInfo->getColumns())===2)//M-M relationships
86 86
                         {
87
-                                $table_name_mm = $fks[0]["table"];
88
-                                $table_name_mm2 = $fks[1]["table"];
87
+                                $table_name_mm=$fks[0]["table"];
88
+                                $table_name_mm2=$fks[1]["table"];
89 89
 
90
-                                $this->_relations[$table_name_mm][] = array(
90
+                                $this->_relations[$table_name_mm][]=array(
91 91
                                         "prop_name" => strtolower($table_name_mm2),
92 92
                                         "rel_type" => "self::MANY_TO_MANY",
93 93
                                         "ref_class_name" => $this->_getProperClassName($table_name_mm2),
94 94
                                         "prop_ref" => $table_name
95 95
                                 );
96 96
 
97
-                                $this->_relations[$table_name_mm2][] = array(
97
+                                $this->_relations[$table_name_mm2][]=array(
98 98
                                         "prop_name" => strtolower($table_name_mm),
99 99
                                         "rel_type" => "self::MANY_TO_MANY",
100 100
                                         "ref_class_name" => $this->_getProperClassName($table_name_mm),
@@ -102,20 +102,20 @@  discard block
 block discarded – undo
102 102
                                 );
103 103
                                 continue;
104 104
                         }
105
-                        foreach ($fks as $fk_data)//1-M relationships
105
+                        foreach($fks as $fk_data)//1-M relationships
106 106
                         {
107
-                                $owner_table = $fk_data["table"];
108
-                                $slave_table = $table_name;
109
-                                $fk_prop = key($fk_data["keys"]);
107
+                                $owner_table=$fk_data["table"];
108
+                                $slave_table=$table_name;
109
+                                $fk_prop=key($fk_data["keys"]);
110 110
 
111
-                                $this->_relations[$owner_table][] = array(
111
+                                $this->_relations[$owner_table][]=array(
112 112
                                         "prop_name" => strtolower($slave_table),
113 113
                                         "rel_type" => "self::HAS_MANY",
114 114
                                         "ref_class_name" => $this->_getProperClassName($slave_table),
115 115
                                         "prop_ref" => $fk_prop
116 116
                                 );
117 117
 
118
-                                $this->_relations[$slave_table][] = array(
118
+                                $this->_relations[$slave_table][]=array(
119 119
                                         "prop_name" => strtolower($owner_table),
120 120
                                         "rel_type" => "self::BELONGS_TO",
121 121
                                         "ref_class_name" => $this->_getProperClassName($owner_table),
@@ -131,88 +131,88 @@  discard block
 block discarded – undo
131 131
 
132 132
         private function _commonGenerate($tableName, $tableInfo)
133 133
         {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
134
+                if(count($tableInfo->getColumns())===0)
135
+                        throw new Exception("Unable to find table or view $tableName in ".$this->_dbMetaData->getDbConnection()->getConnectionString().".");
136 136
                 else
137 137
                 {
138
-                        $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
141
-                        $toString = $this->_buildSmartToString($tableInfo);
138
+                        $properties=array();
139
+                        foreach($tableInfo->getColumns() as $field => $metadata)
140
+                                $properties[]=$this->generateProperty($field, $metadata);
141
+                        $toString=$this->_buildSmartToString($tableInfo);
142 142
                 }
143 143
 
144
-                $clasName = $this->_getProperClassName($tableName);
145
-                $class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
-                $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
144
+                $clasName=$this->_getProperClassName($tableName);
145
+                $class=$this->generateClass($properties, $tableName, $clasName, $toString);
146
+                $output=$this->_opFile.DIRECTORY_SEPARATOR.$clasName.".php";
147 147
                 file_put_contents($output, $class);
148 148
         }
149 149
 
150 150
         private function _getProperClassName($tableName)
151 151
         {
152
-                $table_name_words = str_replace("_", " ", strtolower($tableName));
153
-                $final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
-                return $this->_clasPrefix . $final_conversion . $this->_classSufix;
152
+                $table_name_words=str_replace("_", " ", strtolower($tableName));
153
+                $final_conversion=str_replace(" ", "", ucwords($table_name_words));
154
+                return $this->_clasPrefix.$final_conversion.$this->_classSufix;
155 155
         }
156 156
 
157 157
 //-----------------------------------------------------------------------------
158 158
 
159 159
         protected function generateProperty($field, $metadata)
160 160
         {
161
-                $prop = '';
162
-                $name = '$' . $field;
161
+                $prop='';
162
+                $name='$'.$field;
163 163
 
164 164
                 /* TODO use in version 2.0 */
165 165
                 // $type = $column->getPHPType();
166 166
 
167
-                $prop .= "\tpublic $name;";
167
+                $prop.="\tpublic $name;";
168 168
                 return $prop;
169 169
         }
170 170
 
171 171
         private function _renderRelations($tablename)
172 172
         {
173
-                if (!isset($this->_relations[$tablename]))
173
+                if(!isset($this->_relations[$tablename]))
174 174
                         return "";
175 175
 
176
-                $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
176
+                $code="\tpublic static \$RELATIONS = array (";
177
+                foreach($this->_relations[$tablename] as $rel_data)
178
+                        $code.="\n\t\t'".$rel_data["prop_name"]."' => array(".$rel_data["rel_type"].", '".$rel_data["ref_class_name"]."', '".$rel_data["prop_ref"]."'),";
179 179
 
180
-                $code = substr($code, 0, -1);
181
-                $code .= "\n\t);";
180
+                $code=substr($code, 0, -1);
181
+                $code.="\n\t);";
182 182
                 return $code;
183 183
         }
184 184
 
185 185
         private function _buildSmartToString($tableInfo)
186 186
         {
187
-                $code = "\tpublic function __toString() {";
188
-                $property = "throw new THttpException(500, 'Not implemented yet.');";
187
+                $code="\tpublic function __toString() {";
188
+                $property="throw new THttpException(500, 'Not implemented yet.');";
189 189
                 try
190 190
                 {
191
-                        foreach ($tableInfo->getColumns() as $column)
191
+                        foreach($tableInfo->getColumns() as $column)
192 192
                         {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
193
+                                if(isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
+                                        $property=str_replace($this->uqChars, "", $column->ColumnName);
195
+                                elseif($column->PdoType==PDO::PARAM_STR && $column->DBType!="date")
196 196
                                 {
197
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
197
+                                        $property=str_replace($this->uqChars, "", $column->ColumnName);
198 198
                                         break;
199 199
                                 }
200 200
                         }
201
-                } catch (Exception $ex)
201
+                } catch(Exception $ex)
202 202
                 {
203 203
                         Prado::trace($ex->getMessage());
204 204
                 }
205
-                $code .= "\n\t\treturn \$this->$property;";
206
-                $code .= "\n\t}";
205
+                $code.="\n\t\treturn \$this->$property;";
206
+                $code.="\n\t}";
207 207
                 return $code;
208 208
         }
209 209
 
210 210
         protected function generateClass($properties, $tablename, $classname, $toString)
211 211
         {
212
-                $props = implode("\n", $properties);
213
-                $relations = $this->_renderRelations($tablename);
214
-                $date = date('Y-m-d h:i:s');
215
-                $env_user = getenv("username");
212
+                $props=implode("\n", $properties);
213
+                $relations=$this->_renderRelations($tablename);
214
+                $date=date('Y-m-d h:i:s');
215
+                $env_user=getenv("username");
216 216
                 return <<<EOD
217 217
 <?php
218 218
 /**
Please login to merge, or discard this patch.
framework/Wsat/TWsatScaffoldingGenerator.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -44,6 +44,10 @@  discard block
 block discarded – undo
44 44
 
45 45
     //---------------------------------------------------------------------
46 46
     // <editor-fold defaultstate="collapsed" desc="Page Generation">
47
+
48
+    /**
49
+     * @param integer $viewType
50
+     */
47 51
     public function generate($tableName, $viewType)
48 52
     {
49 53
         switch ($viewType)
@@ -141,6 +145,10 @@  discard block
 block discarded – undo
141 145
 // </editor-fold>
142 146
     //---------------------------------------------------------------------
143 147
     // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
148
+
149
+    /**
150
+     * @param string $classname
151
+     */
144 152
     private function generateClass($classname)
145 153
     {
146 154
         $date = date('Y-m-d h:i:s');
Please login to merge, or discard this patch.
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -14,138 +14,138 @@  discard block
 block discarded – undo
14 14
 class TWsatScaffoldingGenerator extends TWsatBaseGenerator
15 15
 {
16 16
 
17
-    /**
18
-     * Const View Types for generation
19
-     */
20
-    const LIST_TYPE = 0;
21
-    const ADD_TYPE = 1;
22
-    const SHOW_TYPE = 2;
23
-
24
-    /**
25
-     * Bootstrap option
26
-     */
27
-    private $_bootstrap;
28
-
29
-    function __construct()
30
-    {
31
-        parent::__construct();
32
-    }
33
-
34
-    /**
35
-     * Generates CRUD Operations for a single DB table
36
-     * @param type $tableName
37
-     */
38
-    public function generateCRUD($tableName)
39
-    {
40
-        $this->generate($tableName, self::ADD_TYPE);
41
-        $this->generate($tableName, self::LIST_TYPE);
42
-        $this->generate($tableName, self::SHOW_TYPE);
43
-    }
44
-
45
-    //---------------------------------------------------------------------
46
-    // <editor-fold defaultstate="collapsed" desc="Page Generation">
47
-    public function generate($tableName, $viewType)
48
-    {
49
-        switch ($viewType)
50
-        {
51
-            default:
52
-            case self::LIST_TYPE:
53
-                $unitName = "list" . ucfirst($tableName);
54
-                break;
55
-
56
-            case self::ADD_TYPE:
57
-                $unitName = "add" . ucfirst($tableName);
58
-                break;
59
-
60
-            case self::SHOW_TYPE:
61
-                $unitName = "show" . ucfirst($tableName);
62
-                break;
63
-        }
64
-
65
-        $class = $this->generateClass($unitName);
66
-        $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
67
-        file_put_contents($outputClass, $class);
68
-
69
-        $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
-        $page = $this->generatePage($tableName, $viewType);
71
-        file_put_contents($outputPage, $page);
72
-    }
73
-
74
-    private function generatePage($tableName, $type, $tContentId = "Content")
75
-    {
76
-        $pageContent = $this->getPageContent($tableName, $type);
77
-        return <<<EOD
17
+	/**
18
+	 * Const View Types for generation
19
+	 */
20
+	const LIST_TYPE = 0;
21
+	const ADD_TYPE = 1;
22
+	const SHOW_TYPE = 2;
23
+
24
+	/**
25
+	 * Bootstrap option
26
+	 */
27
+	private $_bootstrap;
28
+
29
+	function __construct()
30
+	{
31
+		parent::__construct();
32
+	}
33
+
34
+	/**
35
+	 * Generates CRUD Operations for a single DB table
36
+	 * @param type $tableName
37
+	 */
38
+	public function generateCRUD($tableName)
39
+	{
40
+		$this->generate($tableName, self::ADD_TYPE);
41
+		$this->generate($tableName, self::LIST_TYPE);
42
+		$this->generate($tableName, self::SHOW_TYPE);
43
+	}
44
+
45
+	//---------------------------------------------------------------------
46
+	// <editor-fold defaultstate="collapsed" desc="Page Generation">
47
+	public function generate($tableName, $viewType)
48
+	{
49
+		switch ($viewType)
50
+		{
51
+			default:
52
+			case self::LIST_TYPE:
53
+				$unitName = "list" . ucfirst($tableName);
54
+				break;
55
+
56
+			case self::ADD_TYPE:
57
+				$unitName = "add" . ucfirst($tableName);
58
+				break;
59
+
60
+			case self::SHOW_TYPE:
61
+				$unitName = "show" . ucfirst($tableName);
62
+				break;
63
+		}
64
+
65
+		$class = $this->generateClass($unitName);
66
+		$outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
67
+		file_put_contents($outputClass, $class);
68
+
69
+		$outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
+		$page = $this->generatePage($tableName, $viewType);
71
+		file_put_contents($outputPage, $page);
72
+	}
73
+
74
+	private function generatePage($tableName, $type, $tContentId = "Content")
75
+	{
76
+		$pageContent = $this->getPageContent($tableName, $type);
77
+		return <<<EOD
78 78
 <com:TContent ID="$tContentId">   
79 79
                      
80 80
        $pageContent
81 81
                
82 82
 </com:TContent>
83 83
 EOD;
84
-    }
85
-
86
-    private function getPageContent($tableName, $type)
87
-    {
88
-        $code = "";
89
-        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
-        switch ($type)
91
-        {
92
-            case self::LIST_TYPE:
93
-                break;
94
-            case self::ADD_TYPE:
95
-                foreach ($tableInfo->getColumns() as $colField => $colMetadata)
96
-                {
97
-                    if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98
-                    {
99
-                        $code .= $this->generateControl($colMetadata);
100
-                        $code .= $this->generateValidators($colMetadata);
101
-                        $code .= "\n";
102
-                    }
103
-                }
104
-                foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
105
-                {
106
-                    $colField = $this->eq($colMetadata["table"]);
107
-                    $code .= "\t<com:TTextBox ID=$colField />\n";
108
-                    $code .= "\n";
109
-                    //  TWsatBaseGenerator::pr($tableInfo);
110
-                }
111
-                $code .= "\t<com:TButton Text=\"Accept\" />\n";
112
-
113
-            case self::SHOW_TYPE:
114
-                break;
115
-        }
116
-        return $code;
117
-    }
118
-
119
-    private function generateControl($colMetadata)
120
-    {
121
-        $controlType = "TTextBox";
122
-        switch ($colMetadata->DbType)
123
-        {
84
+	}
85
+
86
+	private function getPageContent($tableName, $type)
87
+	{
88
+		$code = "";
89
+		$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
+		switch ($type)
91
+		{
92
+			case self::LIST_TYPE:
93
+				break;
94
+			case self::ADD_TYPE:
95
+				foreach ($tableInfo->getColumns() as $colField => $colMetadata)
96
+				{
97
+					if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98
+					{
99
+						$code .= $this->generateControl($colMetadata);
100
+						$code .= $this->generateValidators($colMetadata);
101
+						$code .= "\n";
102
+					}
103
+				}
104
+				foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
105
+				{
106
+					$colField = $this->eq($colMetadata["table"]);
107
+					$code .= "\t<com:TTextBox ID=$colField />\n";
108
+					$code .= "\n";
109
+					//  TWsatBaseGenerator::pr($tableInfo);
110
+				}
111
+				$code .= "\t<com:TButton Text=\"Accept\" />\n";
112
+
113
+			case self::SHOW_TYPE:
114
+				break;
115
+		}
116
+		return $code;
117
+	}
118
+
119
+	private function generateControl($colMetadata)
120
+	{
121
+		$controlType = "TTextBox";
122
+		switch ($colMetadata->DbType)
123
+		{
124 124
             
125
-        }
126
-        $controlId = $colMetadata->ColumnId;
127
-        return "\t<com:$controlType ID=\"$controlId\" />\n";
128
-    }
129
-
130
-    private function generateValidators($colMetadata)
131
-    {
132
-        $controlId = $colMetadata->ColumnId;
133
-        $code = "";
134
-        if (!$colMetadata->AllowNull)
135
-        {
136
-            $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137
-        }
138
-        return $code;
139
-    }
125
+		}
126
+		$controlId = $colMetadata->ColumnId;
127
+		return "\t<com:$controlType ID=\"$controlId\" />\n";
128
+	}
129
+
130
+	private function generateValidators($colMetadata)
131
+	{
132
+		$controlId = $colMetadata->ColumnId;
133
+		$code = "";
134
+		if (!$colMetadata->AllowNull)
135
+		{
136
+			$code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137
+		}
138
+		return $code;
139
+	}
140 140
 
141 141
 // </editor-fold>
142
-    //---------------------------------------------------------------------
143
-    // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144
-    private function generateClass($classname)
145
-    {
146
-        $date = date('Y-m-d h:i:s');
147
-        $env_user = getenv("username");
148
-        return <<<EOD
142
+	//---------------------------------------------------------------------
143
+	// <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144
+	private function generateClass($classname)
145
+	{
146
+		$date = date('Y-m-d h:i:s');
147
+		$env_user = getenv("username");
148
+		return <<<EOD
149 149
 <?php
150 150
 /**
151 151
  * Auto generated by PRADO - WSAT on $date.
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 }
158 158
 EOD;
159
-    }
159
+	}
160 160
 
161 161
 // </editor-fold>
162 162
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * Const View Types for generation
19 19
      */
20
-    const LIST_TYPE = 0;
21
-    const ADD_TYPE = 1;
22
-    const SHOW_TYPE = 2;
20
+    const LIST_TYPE=0;
21
+    const ADD_TYPE=1;
22
+    const SHOW_TYPE=2;
23 23
 
24 24
     /**
25 25
      * Bootstrap option
@@ -46,34 +46,34 @@  discard block
 block discarded – undo
46 46
     // <editor-fold defaultstate="collapsed" desc="Page Generation">
47 47
     public function generate($tableName, $viewType)
48 48
     {
49
-        switch ($viewType)
49
+        switch($viewType)
50 50
         {
51 51
             default:
52 52
             case self::LIST_TYPE:
53
-                $unitName = "list" . ucfirst($tableName);
53
+                $unitName="list".ucfirst($tableName);
54 54
                 break;
55 55
 
56 56
             case self::ADD_TYPE:
57
-                $unitName = "add" . ucfirst($tableName);
57
+                $unitName="add".ucfirst($tableName);
58 58
                 break;
59 59
 
60 60
             case self::SHOW_TYPE:
61
-                $unitName = "show" . ucfirst($tableName);
61
+                $unitName="show".ucfirst($tableName);
62 62
                 break;
63 63
         }
64 64
 
65
-        $class = $this->generateClass($unitName);
66
-        $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php";
65
+        $class=$this->generateClass($unitName);
66
+        $outputClass=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".php";
67 67
         file_put_contents($outputClass, $class);
68 68
 
69
-        $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page";
70
-        $page = $this->generatePage($tableName, $viewType);
69
+        $outputPage=$this->_opFile.DIRECTORY_SEPARATOR.$unitName.".page";
70
+        $page=$this->generatePage($tableName, $viewType);
71 71
         file_put_contents($outputPage, $page);
72 72
     }
73 73
 
74
-    private function generatePage($tableName, $type, $tContentId = "Content")
74
+    private function generatePage($tableName, $type, $tContentId="Content")
75 75
     {
76
-        $pageContent = $this->getPageContent($tableName, $type);
76
+        $pageContent=$this->getPageContent($tableName, $type);
77 77
         return <<<EOD
78 78
 <com:TContent ID="$tContentId">   
79 79
                      
@@ -85,30 +85,30 @@  discard block
 block discarded – undo
85 85
 
86 86
     private function getPageContent($tableName, $type)
87 87
     {
88
-        $code = "";
89
-        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
90
-        switch ($type)
88
+        $code="";
89
+        $tableInfo=$this->_dbMetaData->getTableInfo($tableName);
90
+        switch($type)
91 91
         {
92 92
             case self::LIST_TYPE:
93 93
                 break;
94 94
             case self::ADD_TYPE:
95
-                foreach ($tableInfo->getColumns() as $colField => $colMetadata)
95
+                foreach($tableInfo->getColumns() as $colField => $colMetadata)
96 96
                 {
97
-                    if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
97
+                    if(!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey)
98 98
                     {
99
-                        $code .= $this->generateControl($colMetadata);
100
-                        $code .= $this->generateValidators($colMetadata);
101
-                        $code .= "\n";
99
+                        $code.=$this->generateControl($colMetadata);
100
+                        $code.=$this->generateValidators($colMetadata);
101
+                        $code.="\n";
102 102
                     }
103 103
                 }
104
-                foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata)
104
+                foreach($tableInfo->getForeignKeys() as $colField => $colMetadata)
105 105
                 {
106
-                    $colField = $this->eq($colMetadata["table"]);
107
-                    $code .= "\t<com:TTextBox ID=$colField />\n";
108
-                    $code .= "\n";
106
+                    $colField=$this->eq($colMetadata["table"]);
107
+                    $code.="\t<com:TTextBox ID=$colField />\n";
108
+                    $code.="\n";
109 109
                     //  TWsatBaseGenerator::pr($tableInfo);
110 110
                 }
111
-                $code .= "\t<com:TButton Text=\"Accept\" />\n";
111
+                $code.="\t<com:TButton Text=\"Accept\" />\n";
112 112
 
113 113
             case self::SHOW_TYPE:
114 114
                 break;
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
 
119 119
     private function generateControl($colMetadata)
120 120
     {
121
-        $controlType = "TTextBox";
122
-        switch ($colMetadata->DbType)
121
+        $controlType="TTextBox";
122
+        switch($colMetadata->DbType)
123 123
         {
124 124
             
125 125
         }
126
-        $controlId = $colMetadata->ColumnId;
126
+        $controlId=$colMetadata->ColumnId;
127 127
         return "\t<com:$controlType ID=\"$controlId\" />\n";
128 128
     }
129 129
 
130 130
     private function generateValidators($colMetadata)
131 131
     {
132
-        $controlId = $colMetadata->ColumnId;
133
-        $code = "";
134
-        if (!$colMetadata->AllowNull)
132
+        $controlId=$colMetadata->ColumnId;
133
+        $code="";
134
+        if(!$colMetadata->AllowNull)
135 135
         {
136
-            $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
136
+            $code.="\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n";
137 137
         }
138 138
         return $code;
139 139
     }
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
     // <editor-fold defaultstate="collapsed" desc="Code Behind Generation">
144 144
     private function generateClass($classname)
145 145
     {
146
-        $date = date('Y-m-d h:i:s');
147
-        $env_user = getenv("username");
146
+        $date=date('Y-m-d h:i:s');
147
+        $env_user=getenv("username");
148 148
         return <<<EOD
149 149
 <?php
150 150
 /**
Please login to merge, or discard this patch.
framework/Security/TAuthManager.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -289,7 +289,7 @@
 block discarded – undo
289 289
 
290 290
 		// check for authentication expiration
291 291
 		$isAuthExpired = $this->_authExpire>0 && !$user->getIsGuest() &&
292
-        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
292
+		($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
293 293
 
294 294
 		// try authenticating through cookie if possible
295 295
 		if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired))
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 		if(is_string($this->_userManager))
95 95
 		{
96 96
 			if(($users=$application->getModule($this->_userManager))===null)
97
-				throw new TConfigurationException('authmanager_usermanager_inexistent',$this->_userManager);
97
+				throw new TConfigurationException('authmanager_usermanager_inexistent', $this->_userManager);
98 98
 			if(!($users instanceof IUserManager))
99
-				throw new TConfigurationException('authmanager_usermanager_invalid',$this->_userManager);
99
+				throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager);
100 100
 			$this->_userManager=$users;
101 101
 		}
102
-		$application->attachEventHandler('OnAuthentication',array($this,'doAuthentication'));
103
-		$application->attachEventHandler('OnEndRequest',array($this,'leave'));
104
-		$application->attachEventHandler('OnAuthorization',array($this,'doAuthorization'));
102
+		$application->attachEventHandler('OnAuthentication', array($this, 'doAuthentication'));
103
+		$application->attachEventHandler('OnEndRequest', array($this, 'leave'));
104
+		$application->attachEventHandler('OnAuthorization', array($this, 'doAuthorization'));
105 105
 		$this->_initialized=true;
106 106
 	}
107 107
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if($this->_initialized)
123 123
 			throw new TInvalidOperationException('authmanager_usermanager_unchangeable');
124 124
 		if(!is_string($provider) && !($provider instanceof IUserManager))
125
-			throw new TConfigurationException('authmanager_usermanager_invalid',$this->_userManager);
125
+			throw new TConfigurationException('authmanager_usermanager_invalid', $this->_userManager);
126 126
 		$this->_userManager=$provider;
127 127
 	}
128 128
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param mixed sender of the Authentication event
153 153
 	 * @param mixed event parameter
154 154
 	 */
155
-	public function doAuthentication($sender,$param)
155
+	public function doAuthentication($sender, $param)
156 156
 	{
157 157
 		$this->onAuthenticate($param);
158 158
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param mixed sender of the Authorization event
169 169
 	 * @param mixed event parameter
170 170
 	 */
171
-	public function doAuthorization($sender,$param)
171
+	public function doAuthorization($sender, $param)
172 172
 	{
173 173
 		if(!$this->_skipAuthorization)
174 174
 		{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @param mixed sender of the event
184 184
 	 * @param mixed event parameter
185 185
 	 */
186
-	public function leave($sender,$param)
186
+	public function leave($sender, $param)
187 187
 	{
188 188
 		$application=$this->getApplication();
189 189
 		if($application->getResponse()->getStatusCode()===401)
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function setReturnUrl($value)
231 231
 	{
232
-		$this->getSession()->add($this->getReturnUrlVarName(),$value);
232
+		$this->getSession()->add($this->getReturnUrlVarName(), $value);
233 233
 	}
234 234
 
235 235
 	/**
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		$user=$this->_userManager->getUser(null)->loadFromString($sessionInfo);
289 289
 
290 290
 		// check for authentication expiration
291
-		$isAuthExpired = $this->_authExpire>0 && !$user->getIsGuest() &&
292
-        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime<time();
291
+		$isAuthExpired=$this->_authExpire > 0 && !$user->getIsGuest() &&
292
+        ($expiretime=$session->itemAt('AuthExpireTime')) && $expiretime < time();
293 293
 
294 294
 		// try authenticating through cookie if possible
295 295
 		if($this->getAllowAutoLogin() && ($user->getIsGuest() || $isAuthExpired))
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 					$user=$user2;
303 303
 					$this->updateSessionUser($user);
304 304
 					// user is restored from cookie, auth may not expire
305
-					$isAuthExpired = false;
305
+					$isAuthExpired=false;
306 306
 				}
307 307
 			}
308 308
 		}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 		// event handler gets a chance to do further auth work
319 319
 		if($this->hasEventHandler('OnAuthenticate'))
320
-			$this->raiseEvent('OnAuthenticate',$this,$application);
320
+			$this->raiseEvent('OnAuthenticate', $this, $application);
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	{
330 330
 		$this->logout();
331 331
 		if($this->hasEventHandler('OnAuthExpire'))
332
-			$this->raiseEvent('OnAuthExpire',$this,$param);
332
+			$this->raiseEvent('OnAuthExpire', $this, $param);
333 333
 	}
334 334
 
335 335
 	/**
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	{
344 344
 		$application=$this->getApplication();
345 345
 		if($this->hasEventHandler('OnAuthorize'))
346
-			$this->raiseEvent('OnAuthorize',$this,$application);
347
-		if(!$application->getAuthorizationRules()->isUserAllowed($application->getUser(),$application->getRequest()->getRequestType(),$application->getRequest()->getUserHostAddress()))
346
+			$this->raiseEvent('OnAuthorize', $this, $application);
347
+		if(!$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress()))
348 348
 		{
349 349
 			$application->getResponse()->setStatusCode(401);
350 350
 			$application->completeRequest();
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			if(($session=$this->getSession())===null)
384 384
 				throw new TConfigurationException('authmanager_session_required');
385 385
 			else
386
-				$session->add($this->getUserKey(),$user->saveToString());
386
+				$session->add($this->getUserKey(), $user->saveToString());
387 387
 		}
388 388
 	}
389 389
 
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 	 * @param integer number of seconds that automatic login will remain effective. If 0, it means user logs out when session ends. This parameter is added since 3.1.1.
412 412
 	 * @return boolean if login is successful
413 413
 	 */
414
-	public function login($username,$password,$expire=0)
414
+	public function login($username, $password, $expire=0)
415 415
 	{
416
-		if($this->_userManager->validateUser($username,$password))
416
+		if($this->_userManager->validateUser($username, $password))
417 417
 		{
418 418
 			if(($user=$this->_userManager->getUser($username))===null)
419 419
 				return false;
420 420
 			$this->updateSessionUser($user);
421 421
 			$this->getApplication()->setUser($user);
422 422
 
423
-			if($expire>0)
423
+			if($expire > 0)
424 424
 			{
425
-				$cookie=new THttpCookie($this->getUserKey(),'');
426
-				$cookie->setExpire(time()+$expire);
425
+				$cookie=new THttpCookie($this->getUserKey(), '');
426
+				$cookie->setExpire(time() + $expire);
427 427
 				$this->_userManager->saveUserToCookie($cookie);
428 428
 				$this->getResponse()->getCookies()->add($cookie);
429 429
 			}
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		$session->destroy();
447 447
 		if($this->getAllowAutoLogin())
448 448
 		{
449
-			$cookie=new THttpCookie($this->getUserKey(),'');
449
+			$cookie=new THttpCookie($this->getUserKey(), '');
450 450
 			$this->getResponse()->getCookies()->add($cookie);
451 451
 		}
452 452
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -228,6 +228,7 @@  discard block
 block discarded – undo
228 228
 	/**
229 229
 	 * Sets the URL that the browser should be redirected to when login succeeds.
230 230
 	 * @param string the URL to be redirected to.
231
+	 * @param string $value
231 232
 	 */
232 233
 	public function setReturnUrl($value)
233 234
 	{
@@ -376,6 +377,7 @@  discard block
 block discarded – undo
376 377
 	/**
377 378
 	 * Updates the user data stored in session.
378 379
 	 * @param IUser user object
380
+	 * @param TUser $user
379 381
 	 * @throws new TConfigurationException if session module is not loaded.
380 382
 	 */
381 383
 	public function updateSessionUser($user)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -430,8 +430,7 @@
 block discarded – undo
430 430
 				$this->getResponse()->getCookies()->add($cookie);
431 431
 			}
432 432
 			return true;
433
-		}
434
-		else
433
+		} else
435 434
 			return false;
436 435
 	}
437 436
 
Please login to merge, or discard this patch.