Completed
Push — intl ( b391f2...20c33e )
by Fabio
08:04
created
framework/Web/UI/ActiveControls/TCallbackClientSide.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	}
205 205
 
206 206
 	/**
207
-	 * @return boolean true to post the inputs of the form on callback, default
207
+	 * @return string true to post the inputs of the form on callback, default
208 208
 	 * is post the inputs on callback.
209 209
 	 */
210 210
 	public function getPostState()
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	/**
225
-	 * @return integer callback request timeout.
225
+	 * @return string callback request timeout.
226 226
 	 */
227 227
 	public function getRequestTimeOut()
228 228
 	{
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	/**
253
-	 * @return boolean client-side viewstate will be updated on callback
253
+	 * @return boolean|string client-side viewstate will be updated on callback
254 254
 	 * response if true. Default is true.
255 255
 	 */
256 256
 	public function getEnablePageStateUpdate()
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackErrorHandler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 use Prado\Exceptions\TErrorHandler;
16 16
 use Prado\Exceptions\TPhpErrorException;
17 17
 use Prado\Prado;
18
-use Prado\TApplication;
19 18
 use Prado\Web\Javascripts\TJavaScript;
20 19
 
21 20
 /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		if($this->getApplication()->getMode()===TApplicationMode::Debug)
43 43
 		{
44
-			$response = $this->getApplication()->getResponse();
45
-			$trace = $this->getExceptionStackTrace($exception);
44
+			$response=$this->getApplication()->getResponse();
45
+			$trace=$this->getExceptionStackTrace($exception);
46 46
 			// avoid error on non-utf8 strings
47 47
 			try {
48
-				$trace = TJavaScript::jsonEncode($trace);
49
-			} catch (Exception $e) {
48
+				$trace=TJavaScript::jsonEncode($trace);
49
+			} catch(Exception $e) {
50 50
 				// strip everythin not 7bit ascii
51
-				$trace = preg_replace('/[^(\x20-\x7F)]*/','', serialize($trace));
51
+				$trace=preg_replace('/[^(\x20-\x7F)]*/', '', serialize($trace));
52 52
 			}
53 53
 
54 54
 			// avoid exception loop if headers have already been sent
55 55
 			try {
56 56
 				$response->setStatusCode(500, 'Internal Server Error');
57
-			} catch (Exception $e) { }
57
+			} catch(Exception $e) { }
58 58
 
59
-			$content = $response->createHtmlWriter();
59
+			$content=$response->createHtmlWriter();
60 60
 			$content->getWriter()->setBoundary(TActivePageAdapter::CALLBACK_ERROR_HEADER);
61 61
 			$content->write($trace);
62 62
 		}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		$data['type']=get_class($exception);
92 92
 		$data['message']=$exception->getMessage();
93 93
 		$data['version']=$_SERVER['SERVER_SOFTWARE'].' '.Prado::getVersion();
94
-		$data['time']=@strftime('%Y-%m-%d %H:%M',time());
94
+		$data['time']=@strftime('%Y-%m-%d %H:%M', time());
95 95
 		return $data;
96 96
 	}
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/Javascripts/packages.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 //package base folder in prado alias notation
4
-$folders = array(
4
+$folders=array(
5 5
 	'prado' => 'Prado\\Web\\Javascripts\\source\\prado',
6 6
 	'jquery' => 'Vendor\\bower-asset\\jquery\\dist',
7 7
 	'jquery-ui' => 'Vendor\\bower-asset\\jquery-ui',
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 );
14 14
 
15 15
 //package names and its contents (files relative to the current directory)
16
-$packages = array(
16
+$packages=array(
17 17
 	// base prado scripts
18 18
 	'prado' => array(
19 19
 		'prado/prado.js',
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 );
113 113
 
114 114
 //package names and their dependencies
115
-$dependencies = array(
115
+$dependencies=array(
116 116
 	'jquery'			=> array('jquery'),
117 117
 	'prado'				=> array('jquery', 'prado'),
118 118
 	'bootstrap'			=> array('jquery', 'bootstrap'),
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWizard.php 2 patches
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function setActiveStep($step)
202 202
 	{
203
-		if(($index=$this->getWizardSteps()->indexOf($step))<0)
203
+		if(($index=$this->getWizardSteps()->indexOf($step)) < 0)
204 204
 			throw new TInvalidOperationException('wizard_step_invalid');
205 205
 		$this->setActiveStepIndex($index);
206 206
 	}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function getShowCancelButton()
249 249
 	{
250
-		return $this->getViewState('ShowCancelButton',false);
250
+		return $this->getViewState('ShowCancelButton', false);
251 251
 	}
252 252
 
253 253
 	/**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	public function setShowCancelButton($value)
257 257
 	{
258
-		$this->setViewState('ShowCancelButton',TPropertyValue::ensureBoolean($value),false);
258
+		$this->setViewState('ShowCancelButton', TPropertyValue::ensureBoolean($value), false);
259 259
 	}
260 260
 
261 261
 	/**
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public function getShowSideBar()
265 265
 	{
266
-		return $this->getViewState('ShowSideBar',true);
266
+		return $this->getViewState('ShowSideBar', true);
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function setShowSideBar($value)
273 273
 	{
274
-		$this->setViewState('ShowSideBar',TPropertyValue::ensureBoolean($value),true);
274
+		$this->setViewState('ShowSideBar', TPropertyValue::ensureBoolean($value), true);
275 275
 	}
276 276
 
277 277
 	/**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	public function getHeaderText()
366 366
 	{
367
-		return $this->getViewState('HeaderText','');
367
+		return $this->getViewState('HeaderText', '');
368 368
 	}
369 369
 
370 370
 	/**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function setHeaderText($value)
374 374
 	{
375
-		$this->setViewState('HeaderText',TPropertyValue::ensureString($value),'');
375
+		$this->setViewState('HeaderText', TPropertyValue::ensureString($value), '');
376 376
 	}
377 377
 
378 378
 	/**
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public function getCancelDestinationUrl()
383 383
 	{
384
-		return $this->getViewState('CancelDestinationUrl','');
384
+		return $this->getViewState('CancelDestinationUrl', '');
385 385
 	}
386 386
 
387 387
 	/**
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	public function setCancelDestinationUrl($value)
392 392
 	{
393
-		$this->setViewState('CancelDestinationUrl',TPropertyValue::ensureString($value),'');
393
+		$this->setViewState('CancelDestinationUrl', TPropertyValue::ensureString($value), '');
394 394
 	}
395 395
 
396 396
 	/**
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	public function getFinishDestinationUrl()
401 401
 	{
402
-		return $this->getViewState('FinishDestinationUrl','');
402
+		return $this->getViewState('FinishDestinationUrl', '');
403 403
 	}
404 404
 
405 405
 	/**
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	public function setFinishDestinationUrl($value)
409 409
 	{
410
-		$this->setViewState('FinishDestinationUrl',TPropertyValue::ensureString($value),'');
410
+		$this->setViewState('FinishDestinationUrl', TPropertyValue::ensureString($value), '');
411 411
 	}
412 412
 
413 413
 	/**
@@ -415,10 +415,10 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	public function getSideBarButtonStyle()
417 417
 	{
418
-		if(($style=$this->getViewState('SideBarButtonStyle',null))===null)
418
+		if(($style=$this->getViewState('SideBarButtonStyle', null))===null)
419 419
 		{
420 420
 			$style=new TStyle;
421
-			$this->setViewState('SideBarButtonStyle',$style,null);
421
+			$this->setViewState('SideBarButtonStyle', $style, null);
422 422
 		}
423 423
 		return $style;
424 424
 	}
@@ -428,10 +428,10 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function getNavigationButtonStyle()
430 430
 	{
431
-		if(($style=$this->getViewState('NavigationButtonStyle',null))===null)
431
+		if(($style=$this->getViewState('NavigationButtonStyle', null))===null)
432 432
 		{
433 433
 			$style=new TStyle;
434
-			$this->setViewState('NavigationButtonStyle',$style,null);
434
+			$this->setViewState('NavigationButtonStyle', $style, null);
435 435
 		}
436 436
 		return $style;
437 437
 	}
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function getStartNextButtonStyle()
443 443
 	{
444
-		if(($style=$this->getViewState('StartNextButtonStyle',null))===null)
444
+		if(($style=$this->getViewState('StartNextButtonStyle', null))===null)
445 445
 		{
446 446
 			$style=new TWizardNavigationButtonStyle;
447 447
 			$style->setButtonText('Next');
448
-			$this->setViewState('StartNextButtonStyle',$style,null);
448
+			$this->setViewState('StartNextButtonStyle', $style, null);
449 449
 		}
450 450
 		return $style;
451 451
 	}
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	public function getStepNextButtonStyle()
457 457
 	{
458
-		if(($style=$this->getViewState('StepNextButtonStyle',null))===null)
458
+		if(($style=$this->getViewState('StepNextButtonStyle', null))===null)
459 459
 		{
460 460
 			$style=new TWizardNavigationButtonStyle;
461 461
 			$style->setButtonText('Next');
462
-			$this->setViewState('StepNextButtonStyle',$style,null);
462
+			$this->setViewState('StepNextButtonStyle', $style, null);
463 463
 		}
464 464
 		return $style;
465 465
 	}
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	public function getStepPreviousButtonStyle()
471 471
 	{
472
-		if(($style=$this->getViewState('StepPreviousButtonStyle',null))===null)
472
+		if(($style=$this->getViewState('StepPreviousButtonStyle', null))===null)
473 473
 		{
474 474
 			$style=new TWizardNavigationButtonStyle;
475 475
 			$style->setButtonText('Previous');
476
-			$this->setViewState('StepPreviousButtonStyle',$style,null);
476
+			$this->setViewState('StepPreviousButtonStyle', $style, null);
477 477
 		}
478 478
 		return $style;
479 479
 	}
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	public function getFinishCompleteButtonStyle()
485 485
 	{
486
-		if(($style=$this->getViewState('FinishCompleteButtonStyle',null))===null)
486
+		if(($style=$this->getViewState('FinishCompleteButtonStyle', null))===null)
487 487
 		{
488 488
 			$style=new TWizardNavigationButtonStyle;
489 489
 			$style->setButtonText('Complete');
490
-			$this->setViewState('FinishCompleteButtonStyle',$style,null);
490
+			$this->setViewState('FinishCompleteButtonStyle', $style, null);
491 491
 		}
492 492
 		return $style;
493 493
 	}
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	public function getFinishPreviousButtonStyle()
499 499
 	{
500
-		if(($style=$this->getViewState('FinishPreviousButtonStyle',null))===null)
500
+		if(($style=$this->getViewState('FinishPreviousButtonStyle', null))===null)
501 501
 		{
502 502
 			$style=new TWizardNavigationButtonStyle;
503 503
 			$style->setButtonText('Previous');
504
-			$this->setViewState('FinishPreviousButtonStyle',$style,null);
504
+			$this->setViewState('FinishPreviousButtonStyle', $style, null);
505 505
 		}
506 506
 		return $style;
507 507
 	}
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
 	 */
512 512
 	public function getCancelButtonStyle()
513 513
 	{
514
-		if(($style=$this->getViewState('CancelButtonStyle',null))===null)
514
+		if(($style=$this->getViewState('CancelButtonStyle', null))===null)
515 515
 		{
516 516
 			$style=new TWizardNavigationButtonStyle;
517 517
 			$style->setButtonText('Cancel');
518
-			$this->setViewState('CancelButtonStyle',$style,null);
518
+			$this->setViewState('CancelButtonStyle', $style, null);
519 519
 		}
520 520
 		return $style;
521 521
 	}
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 	 */
526 526
 	public function getSideBarStyle()
527 527
 	{
528
-		if(($style=$this->getViewState('SideBarStyle',null))===null)
528
+		if(($style=$this->getViewState('SideBarStyle', null))===null)
529 529
 		{
530 530
 			$style=new TPanelStyle;
531
-			$this->setViewState('SideBarStyle',$style,null);
531
+			$this->setViewState('SideBarStyle', $style, null);
532 532
 		}
533 533
 		return $style;
534 534
 	}
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function getHeaderStyle()
540 540
 	{
541
-		if(($style=$this->getViewState('HeaderStyle',null))===null)
541
+		if(($style=$this->getViewState('HeaderStyle', null))===null)
542 542
 		{
543 543
 			$style=new TPanelStyle;
544
-			$this->setViewState('HeaderStyle',$style,null);
544
+			$this->setViewState('HeaderStyle', $style, null);
545 545
 		}
546 546
 		return $style;
547 547
 	}
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public function getStepStyle()
553 553
 	{
554
-		if(($style=$this->getViewState('StepStyle',null))===null)
554
+		if(($style=$this->getViewState('StepStyle', null))===null)
555 555
 		{
556 556
 			$style=new TPanelStyle;
557
-			$this->setViewState('StepStyle',$style,null);
557
+			$this->setViewState('StepStyle', $style, null);
558 558
 		}
559 559
 		return $style;
560 560
 	}
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	public function getNavigationStyle()
566 566
 	{
567
-		if(($style=$this->getViewState('NavigationStyle',null))===null)
567
+		if(($style=$this->getViewState('NavigationStyle', null))===null)
568 568
 		{
569 569
 			$style=new TPanelStyle;
570
-			$this->setViewState('NavigationStyle',$style,null);
570
+			$this->setViewState('NavigationStyle', $style, null);
571 571
 		}
572 572
 		return $style;
573 573
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	public function getUseDefaultLayout()
579 579
 	{
580
-		return $this->getViewState('UseDefaultLayout',true);
580
+		return $this->getViewState('UseDefaultLayout', true);
581 581
 	}
582 582
 
583 583
 	/**
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	public function setUseDefaultLayout($value)
589 589
 	{
590
-		$this->setViewState('UseDefaultLayout',TPropertyValue::ensureBoolean($value),true);
590
+		$this->setViewState('UseDefaultLayout', TPropertyValue::ensureBoolean($value), true);
591 591
 	}
592 592
 
593 593
 	/**
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public function onActiveStepChanged($param)
648 648
 	{
649
-		$this->raiseEvent('OnActiveStepChanged',$this,$param);
649
+		$this->raiseEvent('OnActiveStepChanged', $this, $param);
650 650
 	}
651 651
 
652 652
 	/**
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 */
658 658
 	public function onCancelButtonClick($param)
659 659
 	{
660
-		$this->raiseEvent('OnCancelButtonClick',$this,$param);
660
+		$this->raiseEvent('OnCancelButtonClick', $this, $param);
661 661
 		if(($url=$this->getCancelDestinationUrl())!=='')
662 662
 			$this->getResponse()->redirect($url);
663 663
 	}
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 */
671 671
 	public function onCompleteButtonClick($param)
672 672
 	{
673
-		$this->raiseEvent('OnCompleteButtonClick',$this,$param);
673
+		$this->raiseEvent('OnCompleteButtonClick', $this, $param);
674 674
 		if(($url=$this->getFinishDestinationUrl())!=='')
675 675
 			$this->getResponse()->redirect($url);
676 676
 	}
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	 */
684 684
 	public function onNextButtonClick($param)
685 685
 	{
686
-		$this->raiseEvent('OnNextButtonClick',$this,$param);
686
+		$this->raiseEvent('OnNextButtonClick', $this, $param);
687 687
 	}
688 688
 
689 689
 	/**
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function onPreviousButtonClick($param)
696 696
 	{
697
-		$this->raiseEvent('OnPreviousButtonClick',$this,$param);
697
+		$this->raiseEvent('OnPreviousButtonClick', $this, $param);
698 698
 	}
699 699
 
700 700
 	/**
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	 */
705 705
 	public function onSideBarButtonClick($param)
706 706
 	{
707
-		$this->raiseEvent('OnSideBarButtonClick',$this,$param);
707
+		$this->raiseEvent('OnSideBarButtonClick', $this, $param);
708 708
 	}
709 709
 
710 710
 	/**
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		{
719 719
 			$this->_multiView=new TMultiView;
720 720
 			$this->_multiView->setID('WizardMultiView');
721
-			$this->_multiView->attachEventHandler('OnActiveViewChanged',array($this,'onActiveStepChanged'));
721
+			$this->_multiView->attachEventHandler('OnActiveViewChanged', array($this, 'onActiveStepChanged'));
722 722
 			$this->_multiView->ignoreBubbleEvents();
723 723
 		}
724 724
 		return $this->_multiView;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		parent::onInit($param);
761 761
 		$this->ensureChildControls();
762 762
 		$this->setEnsureId(true);
763
-		if($this->getActiveStepIndex()<0 && $this->getWizardSteps()->getCount()>0)
763
+		if($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0)
764 764
 			$this->setActiveStepIndex(0);
765 765
 	}
766 766
 
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 	 */
837 837
 	protected function applyHeaderProperties()
838 838
 	{
839
-		if(($style=$this->getViewState('HeaderStyle',null))!==null)
839
+		if(($style=$this->getViewState('HeaderStyle', null))!==null)
840 840
 			$this->_header->getStyle()->mergeWith($style);
841 841
 		if($this->getHeaderTemplate()===null)
842 842
 		{
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 			$this->_sideBarDataList->setDataSource($this->getWizardSteps());
857 857
 			$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
858 858
 			$this->_sideBarDataList->dataBind();
859
-			if(($style=$this->getViewState('SideBarButtonStyle',null))!==null)
859
+			if(($style=$this->getViewState('SideBarButtonStyle', null))!==null)
860 860
 			{
861 861
 				foreach($this->_sideBarDataList->getItems() as $item)
862 862
 				{
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 				}
866 866
 			}
867 867
 		}
868
-		if(($style=$this->getViewState('SideBarStyle',null))!==null)
868
+		if(($style=$this->getViewState('SideBarStyle', null))!==null)
869 869
 			$this->_sideBar->getStyle()->mergeWith($style);
870 870
 	}
871 871
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 */
875 875
 	protected function applyStepContentProperties()
876 876
 	{
877
-		if(($style=$this->getViewState('StepStyle',null))!==null)
877
+		if(($style=$this->getViewState('StepStyle', null))!==null)
878 878
 			$this->_stepContent->getStyle()->mergeWith($style);
879 879
 	}
880 880
 
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 
890 890
 		if(!$this->_navigation)
891 891
 			return;
892
-		else if($activeStepIndex<0 || $activeStepIndex>=$wizardSteps->getCount())
892
+		else if($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount())
893 893
 		{
894 894
 			$this->_navigation->setVisible(false);
895 895
 			return;
@@ -920,12 +920,12 @@  discard block
 block discarded – undo
920 920
 		$this->_stepNavigation->setVisible($showStandard && $activeStepType===TWizardStepType::Step);
921 921
 		$this->_finishNavigation->setVisible($showStandard && $activeStepType===TWizardStepType::Finish);
922 922
 
923
-		if(($navigationStyle=$this->getViewState('NavigationStyle',null))!==null)
923
+		if(($navigationStyle=$this->getViewState('NavigationStyle', null))!==null)
924 924
 			$this->_navigation->getStyle()->mergeWith($navigationStyle);
925 925
 
926 926
 		$displayCancelButton=$this->getShowCancelButton();
927 927
 		$cancelButtonStyle=$this->getCancelButtonStyle();
928
-		$buttonStyle=$this->getViewState('NavigationButtonStyle',null);
928
+		$buttonStyle=$this->getViewState('NavigationButtonStyle', null);
929 929
 		if($buttonStyle!==null)
930 930
 			$cancelButtonStyle->mergeWith($buttonStyle);
931 931
 
@@ -1002,10 +1002,10 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	protected function getHistory()
1004 1004
 	{
1005
-		if(($history=$this->getControlState('History',null))===null)
1005
+		if(($history=$this->getControlState('History', null))===null)
1006 1006
 		{
1007 1007
 			$history=new TStack;
1008
-			$this->setControlState('History',$history);
1008
+			$this->setControlState('History', $history);
1009 1009
 		}
1010 1010
 		return $history;
1011 1011
 	}
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
 		if(($type=$wizardStep->getStepType())===TWizardStepType::Auto)
1021 1021
 		{
1022 1022
 			$steps=$this->getWizardSteps();
1023
-			if(($index=$steps->indexOf($wizardStep))>=0)
1023
+			if(($index=$steps->indexOf($wizardStep)) >= 0)
1024 1024
 			{
1025 1025
 				$stepCount=$steps->getCount();
1026
-				if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete))
1026
+				if($stepCount===1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType()===TWizardStepType::Complete))
1027 1027
 					return TWizardStepType::Finish;
1028 1028
 				else if($index===0)
1029 1029
 					return TWizardStepType::Start;
1030
-				else if($index===$stepCount-1)
1030
+				else if($index===$stepCount - 1)
1031 1031
 					return TWizardStepType::Finish;
1032 1032
 				else
1033 1033
 					return TWizardStepType::Step;
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
 			if(($this->_sideBarDataList=$this->_sideBar->findControl(self::ID_SIDEBAR_LIST))!==null)
1098 1098
 			{
1099
-				$this->_sideBarDataList->attachEventHandler('OnItemCommand',array($this,'dataListItemCommand'));
1100
-				$this->_sideBarDataList->attachEventHandler('OnItemDataBound',array($this,'dataListItemDataBound'));
1099
+				$this->_sideBarDataList->attachEventHandler('OnItemCommand', array($this, 'dataListItemCommand'));
1100
+				$this->_sideBarDataList->attachEventHandler('OnItemDataBound', array($this, 'dataListItemDataBound'));
1101 1101
 				$this->_sideBarDataList->setDataSource($this->getWizardSteps());
1102 1102
 				$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
1103 1103
 				$this->_sideBarDataList->dataBind();
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	 * @param mixed sender of the event
1118 1118
 	 * @param TDataListCommandEventParameter
1119 1119
 	 */
1120
-	public function dataListItemCommand($sender,$param)
1120
+	public function dataListItemCommand($sender, $param)
1121 1121
 	{
1122 1122
 		$item=$param->getItem();
1123 1123
 		if($param->getCommandName()===self::CMD_MOVETO)
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 * @param mixed sender of the event
1154 1154
 	 * @param TDataListItemEventParameter
1155 1155
 	 */
1156
-	public function dataListItemDataBound($sender,$param)
1156
+	public function dataListItemDataBound($sender, $param)
1157 1157
 	{
1158 1158
 		$item=$param->getItem();
1159 1159
 		$itemType=$item->getItemType();
@@ -1276,20 +1276,20 @@  discard block
 block discarded – undo
1276 1276
 	protected function getPreviousStepIndex($popStack)
1277 1277
 	{
1278 1278
 		$history=$this->getHistory();
1279
-		if($history->getCount()>=0)
1279
+		if($history->getCount() >= 0)
1280 1280
 		{
1281 1281
 			$activeStepIndex=$this->getActiveStepIndex();
1282 1282
 			$previousStepIndex=-1;
1283 1283
 			if($popStack)
1284 1284
 			{
1285 1285
 				$previousStepIndex=$history->pop();
1286
-				if($activeStepIndex===$previousStepIndex && $history->getCount()>0)
1286
+				if($activeStepIndex===$previousStepIndex && $history->getCount() > 0)
1287 1287
 					$previousStepIndex=$history->pop();
1288 1288
 			}
1289 1289
 			else
1290 1290
 			{
1291 1291
 				$previousStepIndex=$history->peek();
1292
-				if($activeStepIndex===$previousStepIndex && $history->getCount()>1)
1292
+				if($activeStepIndex===$previousStepIndex && $history->getCount() > 1)
1293 1293
 				{
1294 1294
 					$saveIndex=$history->pop();
1295 1295
 					$previousStepIndex=$history->peek();
@@ -1333,12 +1333,12 @@  discard block
 block discarded – undo
1333 1333
 	 * @param TEventParameter event parameter
1334 1334
 	 * @throws TInvalidDataValueException if a navigation command is associated with an invalid parameter
1335 1335
 	 */
1336
-	public function bubbleEvent($sender,$param)
1336
+	public function bubbleEvent($sender, $param)
1337 1337
 	{
1338 1338
 		if($param instanceof \Prado\Web\UI\TCommandEventParameter)
1339 1339
 		{
1340 1340
 			$command=$param->getCommandName();
1341
-			if(strcasecmp($command,self::CMD_CANCEL)===0)
1341
+			if(strcasecmp($command, self::CMD_CANCEL)===0)
1342 1342
 			{
1343 1343
 				$this->onCancelButtonClick($param);
1344 1344
 				return true;
@@ -1354,49 +1354,49 @@  discard block
 block discarded – undo
1354 1354
 			$movePrev=false;
1355 1355
 			$this->_activeStepIndexSet=false;
1356 1356
 
1357
-			if(strcasecmp($command,self::CMD_NEXT)===0)
1357
+			if(strcasecmp($command, self::CMD_NEXT)===0)
1358 1358
 			{
1359 1359
 				if($type!==TWizardStepType::Start && $type!==TWizardStepType::Step)
1360
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_NEXT);
1361
-				if($index<$this->getWizardSteps()->getCount()-1)
1362
-					$navParam->setNextStepIndex($index+1);
1360
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT);
1361
+				if($index < $this->getWizardSteps()->getCount() - 1)
1362
+					$navParam->setNextStepIndex($index + 1);
1363 1363
 				$this->onNextButtonClick($navParam);
1364 1364
 				$handled=true;
1365 1365
 			}
1366
-			else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1366
+			else if(strcasecmp($command, self::CMD_PREVIOUS)===0)
1367 1367
 			{
1368 1368
 				if($type!==TWizardStepType::Finish && $type!==TWizardStepType::Step)
1369
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS);
1369
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS);
1370 1370
 				$movePrev=true;
1371
-				if(($prevIndex=$this->getPreviousStepIndex(false))>=0)
1371
+				if(($prevIndex=$this->getPreviousStepIndex(false)) >= 0)
1372 1372
 					$navParam->setNextStepIndex($prevIndex);
1373 1373
 				$this->onPreviousButtonClick($navParam);
1374 1374
 				$handled=true;
1375 1375
 			}
1376
-			else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1376
+			else if(strcasecmp($command, self::CMD_COMPLETE)===0)
1377 1377
 			{
1378 1378
 				if($type!==TWizardStepType::Finish)
1379
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE);
1380
-				if($index<$this->getWizardSteps()->getCount()-1)
1381
-					$navParam->setNextStepIndex($index+1);
1379
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE);
1380
+				if($index < $this->getWizardSteps()->getCount() - 1)
1381
+					$navParam->setNextStepIndex($index + 1);
1382 1382
 				$this->onCompleteButtonClick($navParam);
1383 1383
 				$handled=true;
1384 1384
 			}
1385
-			else if(strcasecmp($command,self::CMD_MOVETO)===0)
1385
+			else if(strcasecmp($command, self::CMD_MOVETO)===0)
1386 1386
 			{
1387 1387
 				if($this->_cancelNavigation)  // may be set in onSideBarButtonClick
1388 1388
 					$navParam->setCancelNavigation(true);
1389 1389
 				$requestedStep=$param->getCommandParameter();
1390
-				if (!is_numeric($requestedStep))
1390
+				if(!is_numeric($requestedStep))
1391 1391
 				{
1392 1392
 					$requestedIndex=-1;
1393
-					foreach ($this->getWizardSteps() as $index=>$step)
1394
-						if ($step->getId()===$requestedStep)
1393
+					foreach($this->getWizardSteps() as $index=>$step)
1394
+						if($step->getId()===$requestedStep)
1395 1395
 						{
1396 1396
 							$requestedIndex=$index;
1397 1397
 							break;
1398 1398
 						}
1399
-					if ($requestedIndex<0)
1399
+					if($requestedIndex < 0)
1400 1400
 						throw new TConfigurationException('wizard_step_invalid');
1401 1401
 				}
1402 1402
 				else
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 					if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex))
1414 1414
 					{
1415 1415
 						if($movePrev)
1416
-							$this->getPreviousStepIndex(true);  // pop out the previous move from history
1416
+							$this->getPreviousStepIndex(true); // pop out the previous move from history
1417 1417
 						$this->setActiveStepIndex($nextStepIndex);
1418 1418
 					}
1419 1419
 				}
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -806,8 +806,7 @@  discard block
 block discarded – undo
806 806
 				$this->_navigation->renderControl($writer);
807 807
 				$writer->write("\n</td></tr></table>\n");
808 808
 				$this->renderEndTag($writer);
809
-			}
810
-			else
809
+			} else
811 810
 			{
812 811
 				$this->applyControlProperties();
813 812
 				$this->renderBeginTag($writer);
@@ -905,8 +904,7 @@  discard block
 block discarded – undo
905 904
 				{
906 905
 					$container->setVisible(true);
907 906
 					$showStandard=false;
908
-				}
909
-				else
907
+				} else
910 908
 					$container->setVisible(false);
911 909
 			}
912 910
 		}
@@ -1031,11 +1029,9 @@  discard block
 block discarded – undo
1031 1029
 					return TWizardStepType::Finish;
1032 1030
 				else
1033 1031
 					return TWizardStepType::Step;
1034
-			}
1035
-			else
1032
+			} else
1036 1033
 				return $type;
1037
-		}
1038
-		else
1034
+		} else
1039 1035
 			return $type;
1040 1036
 	}
1041 1037
 
@@ -1102,8 +1098,7 @@  discard block
 block discarded – undo
1102 1098
 				$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
1103 1099
 				$this->_sideBarDataList->dataBind();
1104 1100
 			}
1105
-		}
1106
-		else
1101
+		} else
1107 1102
 		{
1108 1103
 			$this->_sideBar=new TPanel;
1109 1104
 			$this->getControls()->add($this->_sideBar);
@@ -1140,8 +1135,7 @@  discard block
 block discarded – undo
1140 1135
 			{
1141 1136
 				if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex))
1142 1137
 					$this->setActiveStepIndex($newStepIndex);
1143
-			}
1144
-			else
1138
+			} else
1145 1139
 				$this->setActiveStepIndex($stepIndex);
1146 1140
 		}
1147 1141
 	}
@@ -1285,8 +1279,7 @@  discard block
 block discarded – undo
1285 1279
 				$previousStepIndex=$history->pop();
1286 1280
 				if($activeStepIndex===$previousStepIndex && $history->getCount()>0)
1287 1281
 					$previousStepIndex=$history->pop();
1288
-			}
1289
-			else
1282
+			} else
1290 1283
 			{
1291 1284
 				$previousStepIndex=$history->peek();
1292 1285
 				if($activeStepIndex===$previousStepIndex && $history->getCount()>1)
@@ -1297,8 +1290,7 @@  discard block
 block discarded – undo
1297 1290
 				}
1298 1291
 			}
1299 1292
 			return $activeStepIndex===$previousStepIndex ? -1 : $previousStepIndex;
1300
-		}
1301
-		else
1293
+		} else
1302 1294
 			return -1;
1303 1295
 	}
1304 1296
 
@@ -1362,8 +1354,7 @@  discard block
 block discarded – undo
1362 1354
 					$navParam->setNextStepIndex($index+1);
1363 1355
 				$this->onNextButtonClick($navParam);
1364 1356
 				$handled=true;
1365
-			}
1366
-			else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1357
+			} else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1367 1358
 			{
1368 1359
 				if($type!==TWizardStepType::Finish && $type!==TWizardStepType::Step)
1369 1360
 					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS);
@@ -1372,8 +1363,7 @@  discard block
 block discarded – undo
1372 1363
 					$navParam->setNextStepIndex($prevIndex);
1373 1364
 				$this->onPreviousButtonClick($navParam);
1374 1365
 				$handled=true;
1375
-			}
1376
-			else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1366
+			} else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1377 1367
 			{
1378 1368
 				if($type!==TWizardStepType::Finish)
1379 1369
 					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE);
@@ -1381,8 +1371,7 @@  discard block
 block discarded – undo
1381 1371
 					$navParam->setNextStepIndex($index+1);
1382 1372
 				$this->onCompleteButtonClick($navParam);
1383 1373
 				$handled=true;
1384
-			}
1385
-			else if(strcasecmp($command,self::CMD_MOVETO)===0)
1374
+			} else if(strcasecmp($command,self::CMD_MOVETO)===0)
1386 1375
 			{
1387 1376
 				if($this->_cancelNavigation)  // may be set in onSideBarButtonClick
1388 1377
 					$navParam->setCancelNavigation(true);
@@ -1398,8 +1387,7 @@  discard block
 block discarded – undo
1398 1387
 						}
1399 1388
 					if ($requestedIndex<0)
1400 1389
 						throw new TConfigurationException('wizard_step_invalid');
1401
-				}
1402
-				else
1390
+				} else
1403 1391
 					$requestedIndex=TPropertyValue::ensureInteger($requestedStep);
1404 1392
 				$navParam->setNextStepIndex($requestedIndex);
1405 1393
 				$handled=true;
@@ -1416,8 +1404,7 @@  discard block
 block discarded – undo
1416 1404
 							$this->getPreviousStepIndex(true);  // pop out the previous move from history
1417 1405
 						$this->setActiveStepIndex($nextStepIndex);
1418 1406
 					}
1419
-				}
1420
-				else
1407
+				} else
1421 1408
 					$this->setActiveStepIndex($index);
1422 1409
 				return true;
1423 1410
 			}
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiSelectable.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function getWidgetID()
74 74
 	{
75
-	  return $this->getClientID() . '_0';
75
+	  return $this->getClientID().'_0';
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function getOptions()
83 83
 	{
84
-		if (($options=$this->getViewState('JuiOptions'))===null)
84
+		if(($options=$this->getViewState('JuiOptions'))===null)
85 85
 		{
86 86
 		  $options=new TJuiControlOptions($this);
87 87
 		  $this->setViewState('JuiOptions', $options);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	protected function getPostBackOptions()
114 114
 	{
115
-		$options = $this->getOptions()->toArray();
115
+		$options=$this->getOptions()->toArray();
116 116
 		// overload the "OnStop" event to add information about the current selected items
117 117
 		if(isset($options['stop']))
118 118
 		{
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	protected function addAttributesToRender($writer)
129 129
 	{
130 130
 		parent::addAttributesToRender($writer);
131
-		$writer->addAttribute('id',$this->getClientID());
131
+		$writer->addAttribute('id', $this->getClientID());
132 132
 		$options=TJavaScript::encode($this->getPostBackOptions());
133 133
 		$cs=$this->getPage()->getClientScript();
134 134
 		$code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");";
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * Raises the OnCreate event
150 150
 	 * @param object $params event parameters
151 151
 	 */
152
-	public function onCreate ($params)
152
+	public function onCreate($params)
153 153
 	{
154 154
 		$this->raiseEvent('OnCreate', $this, $params);
155 155
 	}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * Raises the OnSelected event
159 159
 	 * @param object $params event parameters
160 160
 	 */
161
-	public function onSelected ($params)
161
+	public function onSelected($params)
162 162
 	{
163 163
 		$this->raiseEvent('OnSelected', $this, $params);
164 164
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * Raises the OnSelecting event
168 168
 	 * @param object $params event parameters
169 169
 	 */
170
-	public function onSelecting ($params)
170
+	public function onSelecting($params)
171 171
 	{
172 172
 		$this->raiseEvent('OnSelecting', $this, $params);
173 173
 	}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * Raises the OnStart event
177 177
 	 * @param object $params event parameters
178 178
 	 */
179
-	public function onStart ($params)
179
+	public function onStart($params)
180 180
 	{
181 181
 		$this->raiseEvent('OnStart', $this, $params);
182 182
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * Raises the OnStop event
186 186
 	 * @param object $params event parameters
187 187
 	 */
188
-	public function onStop ($params)
188
+	public function onStop($params)
189 189
 	{
190 190
 		$this->raiseEvent('OnStop', $this, $params);
191 191
 	}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * Raises the OnUnselected event
195 195
 	 * @param object $params event parameters
196 196
 	 */
197
-	public function onUnselected ($params)
197
+	public function onUnselected($params)
198 198
 	{
199 199
 		$this->raiseEvent('OnUnselected', $this, $params);
200 200
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * Raises the OnUnselecting event
204 204
 	 * @param object $params event parameters
205 205
 	 */
206
-	public function onUnselecting ($params)
206
+	public function onUnselecting($params)
207 207
 	{
208 208
 		$this->raiseEvent('OnUnselecting', $this, $params);
209 209
 	}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	public function getSelectables()
239 239
 	{
240 240
 		if($this->_repeater===null)
241
-			$this->_repeater = $this->createRepeater();
241
+			$this->_repeater=$this->createRepeater();
242 242
 		return $this->_repeater;
243 243
 	}
244 244
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function createRepeater()
249 249
 	{
250
-		$repeater = new TRepeater;
250
+		$repeater=new TRepeater;
251 251
 		$repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getWidgetID().'">'));
252 252
 		$repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>'));
253
-		$repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>',null));
253
+		$repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>', null));
254 254
 		$repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>'));
255 255
 		$this->getControls()->add($repeater);
256 256
 		return $repeater;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	public function setRecordPk($value)
91 91
 	{
92 92
 		$this->clearRecordObject();
93
-		$val = TPropertyValue::ensureArray($value);
93
+		$val=TPropertyValue::ensureArray($value);
94 94
 		$this->setViewState('PK', count($val) > 0 ? $val : null);
95 95
 	}
96 96
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function initializeEditForm()
117 117
 	{
118
-		$record = $this->getCurrentRecord();
119
-		$classPath = $this->getEditRenderer();
120
-		if($classPath === '')
118
+		$record=$this->getCurrentRecord();
119
+		$classPath=$this->getEditRenderer();
120
+		if($classPath==='')
121 121
 		{
122
-			$columns = $this->getTableInfo()->getColumns();
122
+			$columns=$this->getTableInfo()->getColumns();
123 123
 			$this->getInputRepeater()->setDataSource($columns);
124 124
 			$this->getInputRepeater()->dataBind();
125 125
 		}
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	protected function createEditRenderer($record, $classPath)
143 143
 	{
144
-		$this->_editRenderer = Prado::createComponent($classPath);
144
+		$this->_editRenderer=Prado::createComponent($classPath);
145 145
 		if($this->_editRenderer instanceof IScaffoldEditRenderer)
146 146
 		{
147
-			$index = $this->getControls()->remove($this->getInputRepeater());
148
-			$this->getControls()->insertAt($index,$this->_editRenderer);
147
+			$index=$this->getControls()->remove($this->getInputRepeater());
148
+			$this->getControls()->insertAt($index, $this->_editRenderer);
149 149
 			$this->_editRenderer->setData($record);
150 150
 		}
151 151
 		else
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	protected function createRepeaterEditItem($sender, $param)
162 162
 	{
163
-		$type = $param->getItem()->getItemType();
163
+		$type=$param->getItem()->getItemType();
164 164
 		if($type==TListItemType::Item || $type==TListItemType::AlternatingItem)
165 165
 		{
166
-			$item = $param->getItem();
167
-			$column = $item->getData();
166
+			$item=$param->getItem();
167
+			$column=$item->getData();
168 168
 			if($column===null)
169 169
 				return;
170 170
 
171
-			$record = $this->getCurrentRecord();
172
-			$builder = $this->getScaffoldInputBuilder($record);
171
+			$record=$this->getCurrentRecord();
172
+			$builder=$this->getScaffoldInputBuilder($record);
173 173
 			$builder->createScaffoldInput($this, $item, $column, $record);
174 174
 		}
175 175
 	}
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 	{
202 202
 		if($this->getPage()->getIsValid())
203 203
 		{
204
-			$record = $this->getCurrentRecord();
204
+			$record=$this->getCurrentRecord();
205 205
 			if($this->_editRenderer===null)
206 206
 			{
207
-				$table = $this->getTableInfo();
208
-				$builder = $this->getScaffoldInputBuilder($record);
207
+				$table=$this->getTableInfo();
208
+				$builder=$this->getScaffoldInputBuilder($record);
209 209
 				foreach($this->getInputRepeater()->getItems() as $item)
210 210
 				{
211
-					$column = $table->getColumn($item->getCustomData());
211
+					$column=$table->getColumn($item->getCustomData());
212 212
 					$builder->loadScaffoldInput($this, $item, $column, $record);
213 213
 				}
214 214
 			}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	protected function getScaffoldInputBuilder($record)
273 273
 	{
274 274
 		static $_builders=array();
275
-		$class = get_class($record);
275
+		$class=get_class($record);
276 276
 		if(!isset($_builders[$class]))
277 277
 		{
278
-			$_builders[$class] = TScaffoldInputBase::createInputBuilder($record);
278
+			$_builders[$class]=TScaffoldInputBase::createInputBuilder($record);
279 279
 		}
280 280
 		return $_builders[$class];
281 281
 	}
Please login to merge, or discard this patch.
framework/TApplication.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	/**
108 108
 	 * Configuration file type, application.xml and config.xml
109 109
 	 */
110
-	const CONFIG_TYPE_XML = 'xml';
110
+	const CONFIG_TYPE_XML='xml';
111 111
 	/**
112 112
 	 * Application configuration file name
113 113
 	 */
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * Configuration file type, application.php and config.php
121 121
 	 */
122
-	const CONFIG_TYPE_PHP = 'php';
122
+	const CONFIG_TYPE_PHP='php';
123 123
 	/**
124 124
 	 * Runtime directory name
125 125
 	 */
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	/**
273 273
 	 * @var string Customizable page service ID
274 274
 	 */
275
-	private $_pageServiceID = self::PAGE_SERVICE_ID;
275
+	private $_pageServiceID=self::PAGE_SERVICE_ID;
276 276
 
277 277
 	/**
278 278
 	 * Constructor.
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param boolean whether to cache application configuration. Defaults to true.
293 293
 	 * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid.
294 294
 	 */
295
-	public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
295
+	public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
296 296
 	{
297 297
 		// register application as a singleton
298 298
 		Prado::setApplication($this);
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 		// generates unique ID by hashing the runtime path
306 306
 		$this->_uniqueID=md5($this->_runtimePath);
307 307
 		$this->_parameters=new \Prado\Collections\TMap;
308
-		$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
308
+		$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
309 309
 
310
-		Prado::setPathOfAlias('Application',$this->_basePath);
310
+		Prado::setPathOfAlias('Application', $this->_basePath);
311 311
 	}
312 312
 
313 313
 	/**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	{
325 325
 		// determine configuration path and file
326 326
 		if(empty($basePath) || ($basePath=realpath($basePath))===false)
327
-			throw new TConfigurationException('application_basepath_invalid',$basePath);
327
+			throw new TConfigurationException('application_basepath_invalid', $basePath);
328 328
 		if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName()))
329 329
 			$configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName();
330 330
 		else if(is_file($basePath))
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 				if(!is_dir($runtimePath))
346 346
 				{
347 347
 					if(@mkdir($runtimePath)===false)
348
-						throw new TConfigurationException('application_runtimepath_failed',$runtimePath);
348
+						throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
349 349
 					@chmod($runtimePath, PRADO_CHMOD); //make it deletable
350 350
 				}
351 351
 				$this->setConfigurationFile($configFile);
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			$this->setRuntimePath($runtimePath);
355 355
 		}
356 356
 		else
357
-			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
357
+			throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
358 358
 
359 359
 	}
360 360
 
@@ -371,14 +371,14 @@  discard block
 block discarded – undo
371 371
 			$n=count(self::$_steps);
372 372
 			$this->_step=0;
373 373
 			$this->_requestCompleted=false;
374
-			while($this->_step<$n)
374
+			while($this->_step < $n)
375 375
 			{
376 376
 				if($this->_mode===TApplicationMode::Off)
377
-					throw new THttpException(503,'application_unavailable');
377
+					throw new THttpException(503, 'application_unavailable');
378 378
 				if($this->_requestCompleted)
379 379
 					break;
380 380
 				$method=self::$_steps[$this->_step];
381
-				Prado::trace("Executing $method()",'Prado\TApplication');
381
+				Prado::trace("Executing $method()", 'Prado\TApplication');
382 382
 				$this->$method();
383 383
 				$this->_step++;
384 384
 			}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
417 417
 	 * @return mixed the global value corresponding to $key
418 418
 	 */
419
-	public function getGlobalState($key,$defaultValue=null)
419
+	public function getGlobalState($key, $defaultValue=null)
420 420
 	{
421
-		return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue;
421
+		return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue;
422 422
 	}
423 423
 
424 424
 	/**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @param mixed the default value. If $key is not found, $defaultValue will be returned
432 432
 	 * @param boolean wheter to force an immediate GlobalState save. defaults to false
433 433
 	 */
434
-	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
434
+	public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false)
435 435
 	{
436 436
 		$this->_stateChanged=true;
437 437
 		if($value===$defaultValue)
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	 */
532 532
 	public function setMode($value)
533 533
 	{
534
-		$this->_mode=TPropertyValue::ensureEnum($value,'\Prado\TApplicationMode');
534
+		$this->_mode=TPropertyValue::ensureEnum($value, '\Prado\TApplicationMode');
535 535
 	}
536 536
 
537 537
 	/**
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	public function setConfigurationType($value)
581 581
 	{
582
-		$this->_configType = $value;
582
+		$this->_configType=$value;
583 583
 	}
584 584
 
585 585
 	/**
@@ -592,10 +592,10 @@  discard block
 block discarded – undo
592 592
 			switch($this->_configType)
593 593
 			{
594 594
 				case TApplication::CONFIG_TYPE_PHP:
595
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP;
595
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP;
596 596
 					break;
597 597
 				default:
598
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML;
598
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML;
599 599
 			}
600 600
 		}
601 601
 		return $this->_configFileExt;
@@ -607,15 +607,15 @@  discard block
 block discarded – undo
607 607
 	public function getConfigurationFileName()
608 608
 	{
609 609
 		static $fileName;
610
-		if($fileName == null)
610
+		if($fileName==null)
611 611
 		{
612 612
 			switch($this->_configType)
613 613
 			{
614 614
 				case TApplication::CONFIG_TYPE_PHP:
615
-					$fileName = TApplication::CONFIG_FILE_PHP;
615
+					$fileName=TApplication::CONFIG_FILE_PHP;
616 616
 					break;
617 617
 				default:
618
-					$fileName = TApplication::CONFIG_FILE_XML;
618
+					$fileName=TApplication::CONFIG_FILE_XML;
619 619
 			}
620 620
 		}
621 621
 		return $fileName;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	public function setModule($id, IModule $module=null)
667 667
 	{
668 668
 		if(isset($this->_modules[$id]))
669
-			throw new TConfigurationException('application_moduleid_duplicated',$id);
669
+			throw new TConfigurationException('application_moduleid_duplicated', $id);
670 670
 		else
671 671
 			$this->_modules[$id]=$module;
672 672
 	}
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 		// force loading of a lazy module
683 683
 		if($this->_modules[$id]===null)
684 684
 		{
685
-			$module = $this->internalLoadModule($id, true);
685
+			$module=$this->internalLoadModule($id, true);
686 686
 			$module[0]->init($module[1]);
687 687
 		}
688 688
 
@@ -931,37 +931,37 @@  discard block
 block discarded – undo
931 931
 		list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id];
932 932
 		if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force)
933 933
 		{
934
-			Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'\Prado\TApplication');
934
+			Prado::trace("Postponed loading of lazy module $id ({$moduleClass})", '\Prado\TApplication');
935 935
 			$this->setModule($id, null);
936 936
 			return null;
937 937
 		}
938 938
 
939
-		Prado::trace("Loading module $id ({$moduleClass})",'\Prado\TApplication');
939
+		Prado::trace("Loading module $id ({$moduleClass})", '\Prado\TApplication');
940 940
 		$module=Prado::createComponent($moduleClass);
941 941
 		foreach($initProperties as $name=>$value)
942 942
 		{
943 943
 			if($name==='lazy') continue;
944
-			$module->setSubProperty($name,$value);
944
+			$module->setSubProperty($name, $value);
945 945
 		}
946
-		$this->setModule($id,$module);
946
+		$this->setModule($id, $module);
947 947
 		// keep the key to avoid reuse of the old module id
948 948
 		$this->_lazyModules[$id]=null;
949 949
 
950
-		return array($module,$configElement);
950
+		return array($module, $configElement);
951 951
 	}
952 952
 	/**
953 953
 	 * Applies an application configuration.
954 954
 	 * @param TApplicationConfiguration the configuration
955 955
 	 * @param boolean whether the configuration is specified within a service.
956 956
 	 */
957
-	public function applyConfiguration($config,$withinService=false)
957
+	public function applyConfiguration($config, $withinService=false)
958 958
 	{
959 959
 		if($config->getIsEmpty())
960 960
 			return;
961 961
 
962 962
 		// set path aliases and using namespaces
963 963
 		foreach($config->getAliases() as $alias=>$path)
964
-			Prado::setPathOfAlias($alias,$path);
964
+			Prado::setPathOfAlias($alias, $path);
965 965
 		foreach($config->getUsings() as $using)
966 966
 			Prado::using($using);
967 967
 
@@ -969,11 +969,11 @@  discard block
 block discarded – undo
969 969
 		if(!$withinService)
970 970
 		{
971 971
 			foreach($config->getProperties() as $name=>$value)
972
-				$this->setSubProperty($name,$value);
972
+				$this->setSubProperty($name, $value);
973 973
 		}
974 974
 
975 975
 		if(empty($this->_services))
976
-			$this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService',array(),null));
976
+			$this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService', array(), null));
977 977
 
978 978
 		// load parameters
979 979
 		foreach($config->getParameters() as $id=>$parameter)
@@ -982,11 +982,11 @@  discard block
 block discarded – undo
982 982
 			{
983 983
 				$component=Prado::createComponent($parameter[0]);
984 984
 				foreach($parameter[1] as $name=>$value)
985
-					$component->setSubProperty($name,$value);
986
-				$this->_parameters->add($id,$component);
985
+					$component->setSubProperty($name, $value);
986
+				$this->_parameters->add($id, $component);
987 987
 			}
988 988
 			else
989
-				$this->_parameters->add($id,$parameter);
989
+				$this->_parameters->add($id, $parameter);
990 990
 		}
991 991
 
992 992
 		// load and init modules specified in app config
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 			if(!is_string($id))
997 997
 				$id='_module'.count($this->_lazyModules);
998 998
 			$this->_lazyModules[$id]=$moduleConfig;
999
-			if($module = $this->internalLoadModule($id))
999
+			if($module=$this->internalLoadModule($id))
1000 1000
 				$modules[]=$module;
1001 1001
 		}
1002 1002
 		foreach($modules as $module)
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 				$condition=$this->evaluateExpression($condition);
1014 1014
 			if($condition)
1015 1015
 			{
1016
-				if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path))
1017
-					throw new TConfigurationException('application_includefile_invalid',$filePath);
1016
+				if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path))
1017
+					throw new TConfigurationException('application_includefile_invalid', $filePath);
1018 1018
 				$cn=$this->getApplicationConfigurationClass();
1019 1019
 				$c=new $cn;
1020 1020
 				$c->loadFromFile($path);
1021
-				$this->applyConfiguration($c,$withinService);
1021
+				$this->applyConfiguration($c, $withinService);
1022 1022
 			}
1023 1023
 		}
1024 1024
 	}
@@ -1034,21 +1034,21 @@  discard block
 block discarded – undo
1034 1034
 	 */
1035 1035
 	protected function initApplication()
1036 1036
 	{
1037
-		Prado::trace('Initializing application','Prado\TApplication');
1037
+		Prado::trace('Initializing application', 'Prado\TApplication');
1038 1038
 
1039 1039
 		if($this->_configFile!==null)
1040 1040
 		{
1041
-			if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile))
1041
+			if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile))
1042 1042
 			{
1043 1043
 				$config=new TApplicationConfiguration;
1044 1044
 				$config->loadFromFile($this->_configFile);
1045 1045
 				if($this->_cacheFile!==null)
1046
-					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
1046
+					file_put_contents($this->_cacheFile, serialize($config), LOCK_EX);
1047 1047
 			}
1048 1048
 			else
1049 1049
 				$config=unserialize(file_get_contents($this->_cacheFile));
1050 1050
 
1051
-			$this->applyConfiguration($config,false);
1051
+			$this->applyConfiguration($config, false);
1052 1052
 		}
1053 1053
 
1054 1054
 		if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null)
@@ -1067,32 +1067,32 @@  discard block
 block discarded – undo
1067 1067
 	{
1068 1068
 		if(isset($this->_services[$serviceID]))
1069 1069
 		{
1070
-			list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID];
1070
+			list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID];
1071 1071
 			$service=Prado::createComponent($serviceClass);
1072 1072
 			if(!($service instanceof IService))
1073
-				throw new THttpException(500,'application_service_invalid',$serviceClass);
1073
+				throw new THttpException(500, 'application_service_invalid', $serviceClass);
1074 1074
 			if(!$service->getEnabled())
1075
-				throw new THttpException(500,'application_service_unavailable',$serviceClass);
1075
+				throw new THttpException(500, 'application_service_unavailable', $serviceClass);
1076 1076
 			$service->setID($serviceID);
1077 1077
 			$this->setService($service);
1078 1078
 
1079 1079
 			foreach($initProperties as $name=>$value)
1080
-				$service->setSubProperty($name,$value);
1080
+				$service->setSubProperty($name, $value);
1081 1081
 
1082 1082
 			if($configElement!==null)
1083 1083
 			{
1084 1084
 				$config=new TApplicationConfiguration;
1085 1085
 				if($this->getConfigurationType()==self::CONFIG_TYPE_PHP)
1086
-					$config->loadFromPhp($configElement,$this->getBasePath());
1086
+					$config->loadFromPhp($configElement, $this->getBasePath());
1087 1087
 				else
1088
-					$config->loadFromXml($configElement,$this->getBasePath());
1089
-				$this->applyConfiguration($config,true);
1088
+					$config->loadFromXml($configElement, $this->getBasePath());
1089
+				$this->applyConfiguration($config, true);
1090 1090
 			}
1091 1091
 
1092 1092
 			$service->init($configElement);
1093 1093
 		}
1094 1094
 		else
1095
-			throw new THttpException(500,'application_service_unknown',$serviceID);
1095
+			throw new THttpException(500, 'application_service_unknown', $serviceID);
1096 1096
 	}
1097 1097
 
1098 1098
 	/**
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
 	 */
1104 1104
 	public function onError($param)
1105 1105
 	{
1106
-		Prado::log($param->getMessage(),TLogger::ERROR,'Prado\TApplication');
1107
-		$this->raiseEvent('OnError',$this,$param);
1108
-		$this->getErrorHandler()->handleError($this,$param);
1106
+		Prado::log($param->getMessage(), TLogger::ERROR, 'Prado\TApplication');
1107
+		$this->raiseEvent('OnError', $this, $param);
1108
+		$this->getErrorHandler()->handleError($this, $param);
1109 1109
 	}
1110 1110
 
1111 1111
 	/**
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	public function onBeginRequest()
1119 1119
 	{
1120
-		$this->raiseEvent('OnBeginRequest',$this,null);
1120
+		$this->raiseEvent('OnBeginRequest', $this, null);
1121 1121
 	}
1122 1122
 
1123 1123
 	/**
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 	 */
1127 1127
 	public function onAuthentication()
1128 1128
 	{
1129
-		$this->raiseEvent('OnAuthentication',$this,null);
1129
+		$this->raiseEvent('OnAuthentication', $this, null);
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 	 */
1136 1136
 	public function onAuthenticationComplete()
1137 1137
 	{
1138
-		$this->raiseEvent('OnAuthenticationComplete',$this,null);
1138
+		$this->raiseEvent('OnAuthenticationComplete', $this, null);
1139 1139
 	}
1140 1140
 
1141 1141
 	/**
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 	 */
1145 1145
 	public function onAuthorization()
1146 1146
 	{
1147
-		$this->raiseEvent('OnAuthorization',$this,null);
1147
+		$this->raiseEvent('OnAuthorization', $this, null);
1148 1148
 	}
1149 1149
 
1150 1150
 	/**
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 */
1154 1154
 	public function onAuthorizationComplete()
1155 1155
 	{
1156
-		$this->raiseEvent('OnAuthorizationComplete',$this,null);
1156
+		$this->raiseEvent('OnAuthorizationComplete', $this, null);
1157 1157
 	}
1158 1158
 
1159 1159
 	/**
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	public function onLoadState()
1164 1164
 	{
1165 1165
 		$this->loadGlobals();
1166
-		$this->raiseEvent('OnLoadState',$this,null);
1166
+		$this->raiseEvent('OnLoadState', $this, null);
1167 1167
 	}
1168 1168
 
1169 1169
 	/**
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 	 */
1173 1173
 	public function onLoadStateComplete()
1174 1174
 	{
1175
-		$this->raiseEvent('OnLoadStateComplete',$this,null);
1175
+		$this->raiseEvent('OnLoadStateComplete', $this, null);
1176 1176
 	}
1177 1177
 
1178 1178
 	/**
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 	 */
1182 1182
 	public function onPreRunService()
1183 1183
 	{
1184
-		$this->raiseEvent('OnPreRunService',$this,null);
1184
+		$this->raiseEvent('OnPreRunService', $this, null);
1185 1185
 	}
1186 1186
 
1187 1187
 	/**
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 	 */
1200 1200
 	public function onSaveState()
1201 1201
 	{
1202
-		$this->raiseEvent('OnSaveState',$this,null);
1202
+		$this->raiseEvent('OnSaveState', $this, null);
1203 1203
 		$this->saveGlobals();
1204 1204
 	}
1205 1205
 
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 	 */
1210 1210
 	public function onSaveStateComplete()
1211 1211
 	{
1212
-		$this->raiseEvent('OnSaveStateComplete',$this,null);
1212
+		$this->raiseEvent('OnSaveStateComplete', $this, null);
1213 1213
 	}
1214 1214
 
1215 1215
 	/**
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 	 */
1219 1219
 	public function onPreFlushOutput()
1220 1220
 	{
1221
-		$this->raiseEvent('OnPreFlushOutput',$this,null);
1221
+		$this->raiseEvent('OnPreFlushOutput', $this, null);
1222 1222
 	}
1223 1223
 
1224 1224
 	/**
1225 1225
 	 * Flushes output to client side.
1226 1226
 	 * @param boolean whether to continue buffering after flush if buffering was active
1227 1227
 	 */
1228
-	public function flushOutput($continueBuffering = true)
1228
+	public function flushOutput($continueBuffering=true)
1229 1229
 	{
1230 1230
 		$this->getResponse()->flush($continueBuffering);
1231 1231
 	}
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
 	public function onEndRequest()
1238 1238
 	{
1239 1239
 		$this->flushOutput(false); // flush all remaining content in the buffer
1240
-		$this->saveGlobals();  // save global state
1241
-		$this->raiseEvent('OnEndRequest',$this,null);
1240
+		$this->saveGlobals(); // save global state
1241
+		$this->raiseEvent('OnEndRequest', $this, null);
1242 1242
 	}
1243 1243
 }
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -110,13 +110,13 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * Factory method to instantiate a new MessageSource depending on the
112 112
 	 * source type. The allowed source types are 'XLIFF', 'PHP', 'gettext' and
113
-     * 'Database'. The source parameter depends on the source type. 
114
-     * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory 
115
-     * where the messages are stored. 
116
-     * For 'Database', 'source' must be a valid connection id.
113
+	 * 'Database'. The source parameter depends on the source type. 
114
+	 * For 'gettext', 'PHP' and 'XLIFF', 'source' should point to the directory 
115
+	 * where the messages are stored. 
116
+	 * For 'Database', 'source' must be a valid connection id.
117 117
 	 *
118
- 	 * Custom message source are possible by supplying the a filename parameter
119
- 	 * in the factory method.
118
+	 * Custom message source are possible by supplying the a filename parameter
119
+	 * in the factory method.
120 120
 	 * 
121 121
 	 * @param string the message source type.
122 122
 	 * @param string the location of the resource or the ConnectionID.
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * Array of translation messages.
83 83
 	 * @var array 
84 84
 	 */
85
-	protected $messages = array();
85
+	protected $messages=array();
86 86
 
87 87
 	/**
88 88
 	 * The source of message translations.
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	protected $cache;
98 98
 	
99
-	protected $untranslated = array();
99
+	protected $untranslated=array();
100 100
 
101 101
 	/**
102 102
 	 * Private constructor. MessageSource must be initialized using
@@ -126,23 +126,23 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	static function &factory($type, $source='.', $filename='')
128 128
 	{
129
-		$types = array('XLIFF','PHP','gettext','Database');
129
+		$types=array('XLIFF', 'PHP', 'gettext', 'Database');
130 130
 
131 131
 		if(empty($filename) && !in_array($type, $types))
132 132
 			throw new Exception('Invalid type "'.$type.'", valid types are '.
133 133
 				implode(', ', $types));
134 134
 		
135
-		$class = 'MessageSource_'.$type;
135
+		$class='MessageSource_'.$type;
136 136
 		
137 137
 		if(empty($filename))
138
-			$filename = dirname(__FILE__).'/'.$class.'.php';
138
+			$filename=dirname(__FILE__).'/'.$class.'.php';
139 139
 						
140
-		if(is_file($filename) == false)
140
+		if(is_file($filename)==false)
141 141
 			throw new Exception("File $filename not found");
142 142
 						
143 143
 		include_once $filename;
144 144
         
145
-		$obj =  new $class($source);
145
+		$obj=new $class($source);
146 146
 		
147 147
 		return $obj;
148 148
 	}
@@ -168,36 +168,36 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function load($catalogue='messages')
170 170
 	{
171
-		$variants = $this->getCatalogueList($catalogue);
171
+		$variants=$this->getCatalogueList($catalogue);
172 172
 		
173
-		$this->messages = array();
173
+		$this->messages=array();
174 174
 		
175 175
 		foreach($variants as $variant)
176 176
 		{
177
-			$source = $this->getSource($variant);
177
+			$source=$this->getSource($variant);
178 178
 			
179
-			if($this->isValidSource($source) == false) continue;
179
+			if($this->isValidSource($source)==false) continue;
180 180
 
181
-			$loadData = true;
181
+			$loadData=true;
182 182
 			
183 183
 			if($this->cache)
184 184
 			{
185
-				$data = $this->cache->get($variant, 
185
+				$data=$this->cache->get($variant, 
186 186
 					$this->culture, $this->getLastModified($source));
187 187
 				
188 188
 				if(is_array($data))
189 189
 				{
190
-					$this->messages[$variant] = $data;
191
-					$loadData = false;
190
+					$this->messages[$variant]=$data;
191
+					$loadData=false;
192 192
 				}
193 193
 				unset($data);
194 194
 			}
195 195
 			if($loadData)
196 196
 			{
197
-				$data = &$this->loadData($source);
197
+				$data=&$this->loadData($source);
198 198
 				if(is_array($data))
199 199
 				{
200
-					$this->messages[$variant] = $data;
200
+					$this->messages[$variant]=$data;
201 201
 					if($this->cache)
202 202
 						$this->cache->save($data, $variant, $this->culture);
203 203
 				}	
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function setCache(MessageCache $cache)
235 235
 	{
236
-		$this->cache = $cache;
236
+		$this->cache=$cache;
237 237
 	}
238 238
 	
239 239
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	public function append($message)
245 245
 	{
246 246
 		if(!in_array($message, $this->untranslated))
247
-			$this->untranslated[] = $message;
247
+			$this->untranslated[]=$message;
248 248
 	}
249 249
 	
250 250
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function setCulture($culture)
255 255
 	{
256
-		$this->culture = $culture;
256
+		$this->culture=$culture;
257 257
 	}	
258 258
 	
259 259
 	/**
Please login to merge, or discard this patch.
bin/prado-cli.php 2 patches
Doc Comments   +25 added lines patch added patch discarded remove patch
@@ -143,6 +143,10 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	abstract public function performAction($args);
145 145
 
146
+	/**
147
+	 * @param string $dir
148
+	 * @param integer $mask
149
+	 */
146 150
 	protected function createDirectory($dir, $mask)
147 151
 	{
148 152
 		if(!is_dir($dir))
@@ -154,6 +158,9 @@  discard block
 block discarded – undo
154 158
 			chmod($dir, $mask);
155 159
 	}
156 160
 
161
+	/**
162
+	 * @param string $filename
163
+	 */
157 164
 	protected function createFile($filename, $content)
158 165
 	{
159 166
 		if(!is_file($filename))
@@ -302,6 +309,9 @@  discard block
 block discarded – undo
302 309
 ';
303 310
 	}
304 311
 
312
+	/**
313
+	 * @param string $appName
314
+	 */
305 315
 	protected function renderConfigFile($appName)
306 316
 	{
307 317
 		return <<<EOD
@@ -515,6 +525,9 @@  discard block
 block discarded – undo
515 525
 		return false;
516 526
 	}
517 527
 
528
+	/**
529
+	 * @param string $app_dir
530
+	 */
518 531
 	protected function getActiveRecordConfig($app_dir)
519 532
 	{
520 533
 		if(false === ($xml=$this->getXmlFile($app_dir)))
@@ -530,6 +543,9 @@  discard block
 block discarded – undo
530 543
 		return false;
531 544
 	}
532 545
 
546
+	/**
547
+	 * @param string $app_dir
548
+	 */
533 549
 	protected function getOutputFile($app_dir, $namespace)
534 550
 	{
535 551
 		if(is_file($namespace) && strpos($namespace, $app_dir)===0)
@@ -591,6 +607,9 @@  discard block
 block discarded – undo
591 607
 		return $prop;
592 608
 	}
593 609
 
610
+	/**
611
+	 * @param string $class
612
+	 */
594 613
 	protected function generateClass($properties, $tablename, $class)
595 614
 	{
596 615
 		$props = implode("\n", $properties);
@@ -686,6 +705,9 @@  discard block
 block discarded – undo
686 705
         return true;
687 706
     }
688 707
 
708
+    /**
709
+     * @param string $l
710
+     */
689 711
     public function generate($l)
690 712
     {
691 713
 		$input = explode(" ", trim($l));
@@ -724,6 +746,9 @@  discard block
 block discarded – undo
724 746
         return false;
725 747
     }
726 748
 
749
+    /**
750
+     * @param string $app_dir
751
+     */
727 752
     protected function getActiveRecordConfig($app_dir) {
728 753
         if (false === ($xml = $this->getXmlFile($app_dir)))
729 754
             return false;
Please login to merge, or discard this patch.
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 	die('Must be run from the command line');
14 14
 
15 15
 // Locate composer's autoloader
16
-if(file_exists($autoloader = realpath(__DIR__ . '/../vendor/autoload.php')))
16
+if(file_exists($autoloader=realpath(__DIR__.'/../vendor/autoload.php')))
17 17
 {
18 18
 	// if we are running inside a prado repo checkout, get out of bin/
19 19
 	include($autoloader);
20
-} elseif(file_exists($autoloader = realpath(__DIR__ . '/../../../autoload.php'))) {
20
+} elseif(file_exists($autoloader=realpath(__DIR__.'/../../../autoload.php'))) {
21 21
 	// if we are running from inside an application's vendor/ directory, get out of pradosoft/prado/bin/
22 22
 	include($autoloader);
23 23
 }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function addActionClass($class)
71 71
 	{
72
-		$this->_actions[$class] = new $class;
72
+		$this->_actions[$class]=new $class;
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	public static function getInstance()
79 79
 	{
80 80
 		static $instance;
81
-		if($instance === null)
82
-			$instance = new self;
81
+		if($instance===null)
82
+			$instance=new self;
83 83
 		return $instance;
84 84
 	}
85 85
 
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	{
97 97
 		if(count($args) > 1)
98 98
 			array_shift($args);
99
-		$valid = false;
99
+		$valid=false;
100 100
 		foreach($this->_actions as $class => $action)
101 101
 		{
102 102
 			if($action->isValidAction($args))
103 103
 			{
104
-				$valid |= $action->performAction($args);
104
+				$valid|=$action->performAction($args);
105 105
 				break;
106 106
 			}
107 107
 			else
108 108
 			{
109
-				$valid = false;
109
+				$valid=false;
110 110
 			}
111 111
 		}
112 112
 		if(!$valid)
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
 
166 166
 	public function isValidAction($args)
167 167
 	{
168
-		return 0 == strcasecmp($args[0], $this->action) &&
169
-			count($args)-1 >= count($this->parameters);
168
+		return 0==strcasecmp($args[0], $this->action) &&
169
+			count($args) - 1 >= count($this->parameters);
170 170
 	}
171 171
 
172 172
 	public function renderHelp()
173 173
 	{
174
-		$params = array();
174
+		$params=array();
175 175
 		foreach($this->parameters as $v)
176
-			$params[] = '<'.$v.'>';
177
-		$parameters = join($params, ' ');
178
-		$options = array();
176
+			$params[]='<'.$v.'>';
177
+		$parameters=join($params, ' ');
178
+		$options=array();
179 179
 		foreach($this->optional as $v)
180
-			$options[] = '['.$v.']';
181
-		$optional = (strlen($parameters) ? ' ' : ''). join($options, ' ');
180
+			$options[]='['.$v.']';
181
+		$optional=(strlen($parameters) ? ' ' : '').join($options, ' ');
182 182
 		$description='';
183
-		foreach(explode("\n", wordwrap($this->description,65)) as $line)
184
-			$description .= '    '.$line."\n";
183
+		foreach(explode("\n", wordwrap($this->description, 65)) as $line)
184
+			$description.='    '.$line."\n";
185 185
 		return <<<EOD
186 186
   {$this->action} {$parameters}{$optional}
187 187
 {$description}
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 
192 192
 	protected function initializePradoApplication($directory)
193 193
 	{
194
-		$_SERVER['SCRIPT_FILENAME'] = $directory.'/index.php';
195
-		$app_dir = realpath($directory.'/protected/');
196
-		if($app_dir !== false && is_dir($app_dir))
194
+		$_SERVER['SCRIPT_FILENAME']=$directory.'/index.php';
195
+		$app_dir=realpath($directory.'/protected/');
196
+		if($app_dir!==false && is_dir($app_dir))
197 197
 		{
198 198
 			if(Prado::getApplication()===null)
199 199
 			{
200
-				$app = new PradoShellApplication($app_dir);
200
+				$app=new PradoShellApplication($app_dir);
201 201
 				$app->run();
202
-				$dir = substr(str_replace(realpath('./'),'',$app_dir),1);
202
+				$dir=substr(str_replace(realpath('./'), '', $app_dir), 1);
203 203
 				PradoCommandLineInterpreter::printGreeting();
204 204
 				echo '** Loaded PRADO appplication in directory "'.$dir."\".\n";
205 205
 			}
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		else
210 210
 		{
211 211
 			PradoCommandLineInterpreter::printGreeting();
212
-			echo '+'.str_repeat('-',77)."+\n";
212
+			echo '+'.str_repeat('-', 77)."+\n";
213 213
 			echo '** Unable to load PRADO application in directory "'.$directory."\".\n";
214
-			echo '+'.str_repeat('-',77)."+\n";
214
+			echo '+'.str_repeat('-', 77)."+\n";
215 215
 		}
216 216
 		return false;
217 217
 	}
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  */
227 227
 class PradoCommandLineCreateProject extends PradoCommandLineAction
228 228
 {
229
-	protected $action = '-c';
230
-	protected $parameters = array('directory');
231
-	protected $optional = array();
232
-	protected $description = 'Creates a Prado project skeleton for the given <directory>.';
229
+	protected $action='-c';
230
+	protected $parameters=array('directory');
231
+	protected $optional=array();
232
+	protected $description='Creates a Prado project skeleton for the given <directory>.';
233 233
 
234 234
 	public function performAction($args)
235 235
 	{
@@ -243,31 +243,31 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function createNewPradoProject($dir)
245 245
 	{
246
-		if(strlen(trim($dir)) == 0)
246
+		if(strlen(trim($dir))==0)
247 247
 			return;
248 248
 
249
-		$rootPath = realpath(dirname(trim($dir)));
249
+		$rootPath=realpath(dirname(trim($dir)));
250 250
 
251 251
 		if(basename($dir)!=='.')
252
-			$basePath = $rootPath.DIRECTORY_SEPARATOR.basename($dir);
252
+			$basePath=$rootPath.DIRECTORY_SEPARATOR.basename($dir);
253 253
 		else
254
-			$basePath = $rootPath;
255
-		$appName = basename($basePath);
256
-		$assetPath = $basePath.DIRECTORY_SEPARATOR.'assets';
257
-		$protectedPath  = $basePath.DIRECTORY_SEPARATOR.'protected';
258
-		$runtimePath = $basePath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'runtime';
259
-		$pagesPath = $protectedPath.DIRECTORY_SEPARATOR.'pages';
260
-
261
-		$indexFile = $basePath.DIRECTORY_SEPARATOR.'index.php';
262
-		$htaccessFile = $protectedPath.DIRECTORY_SEPARATOR.'.htaccess';
263
-		$configFile = $protectedPath.DIRECTORY_SEPARATOR.'application.xml';
264
-		$defaultPageFile = $pagesPath.DIRECTORY_SEPARATOR.'Home.page';
254
+			$basePath=$rootPath;
255
+		$appName=basename($basePath);
256
+		$assetPath=$basePath.DIRECTORY_SEPARATOR.'assets';
257
+		$protectedPath=$basePath.DIRECTORY_SEPARATOR.'protected';
258
+		$runtimePath=$basePath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'runtime';
259
+		$pagesPath=$protectedPath.DIRECTORY_SEPARATOR.'pages';
260
+
261
+		$indexFile=$basePath.DIRECTORY_SEPARATOR.'index.php';
262
+		$htaccessFile=$protectedPath.DIRECTORY_SEPARATOR.'.htaccess';
263
+		$configFile=$protectedPath.DIRECTORY_SEPARATOR.'application.xml';
264
+		$defaultPageFile=$pagesPath.DIRECTORY_SEPARATOR.'Home.page';
265 265
 
266 266
 		$this->createDirectory($basePath, 0755);
267
-		$this->createDirectory($assetPath,0777);
268
-		$this->createDirectory($protectedPath,0755);
269
-		$this->createDirectory($runtimePath,0777);
270
-		$this->createDirectory($pagesPath,0755);
267
+		$this->createDirectory($assetPath, 0777);
268
+		$this->createDirectory($protectedPath, 0755);
269
+		$this->createDirectory($runtimePath, 0777);
270
+		$this->createDirectory($pagesPath, 0755);
271 271
 
272 272
 		$this->createFile($indexFile, $this->renderIndexFile());
273 273
 		$this->createFile($configFile, $this->renderConfigFile($appName));
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 	protected function renderIndexFile()
279 279
 	{
280
-		$framework = realpath(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'prado.php';
280
+		$framework=realpath(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'framework'.DIRECTORY_SEPARATOR.'prado.php';
281 281
 return '<?php
282 282
 
283 283
 $frameworkPath=\''.$framework.'\';
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
  */
377 377
 class PradoCommandLineCreateTests extends PradoCommandLineAction
378 378
 {
379
-	protected $action = '-t';
380
-	protected $parameters = array('directory');
381
-	protected $optional = array();
382
-	protected $description = 'Create test fixtures in the given <directory>.';
379
+	protected $action='-t';
380
+	protected $parameters=array('directory');
381
+	protected $optional=array();
382
+	protected $description='Create test fixtures in the given <directory>.';
383 383
 
384 384
 	public function performAction($args)
385 385
 	{
@@ -390,22 +390,22 @@  discard block
 block discarded – undo
390 390
 
391 391
 	protected function createTestFixtures($dir)
392 392
 	{
393
-		if(strlen(trim($dir)) == 0)
393
+		if(strlen(trim($dir))==0)
394 394
 			return;
395 395
 
396
-		$rootPath = realpath(dirname(trim($dir)));
397
-		$basePath = $rootPath.'/'.basename($dir);
396
+		$rootPath=realpath(dirname(trim($dir)));
397
+		$basePath=$rootPath.'/'.basename($dir);
398 398
 
399
-		$tests = $basePath.'/tests';
400
-		$unit_tests = $tests.'/unit';
401
-		$functional_tests = $tests.'/functional';
399
+		$tests=$basePath.'/tests';
400
+		$unit_tests=$tests.'/unit';
401
+		$functional_tests=$tests.'/functional';
402 402
 
403
-		$this->createDirectory($tests,0755);
404
-		$this->createDirectory($unit_tests,0755);
405
-		$this->createDirectory($functional_tests,0755);
403
+		$this->createDirectory($tests, 0755);
404
+		$this->createDirectory($unit_tests, 0755);
405
+		$this->createDirectory($functional_tests, 0755);
406 406
 
407
-		$unit_test_index = $tests.'/unit.php';
408
-		$functional_test_index = $tests.'/functional.php';
407
+		$unit_test_index=$tests.'/unit.php';
408
+		$functional_test_index=$tests.'/functional.php';
409 409
 
410 410
 		$this->createFile($unit_test_index, $this->renderUnitTestFixture());
411 411
 		$this->createFile($functional_test_index, $this->renderFunctionalTestFixture());
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 	protected function renderUnitTestFixture()
415 415
 	{
416
-		$tester = realpath(dirname(dirname(__FILE__))).'/tests/test_tools/unit_tests.php';
416
+		$tester=realpath(dirname(dirname(__FILE__))).'/tests/test_tools/unit_tests.php';
417 417
 return '<?php
418 418
 
419 419
 include_once \''.$tester.'\';
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 	protected function renderFunctionalTestFixture()
430 430
 	{
431
-		$tester = realpath(dirname(dirname(__FILE__))).'/tests/test_tools/functional_tests.php';
431
+		$tester=realpath(dirname(dirname(__FILE__))).'/tests/test_tools/functional_tests.php';
432 432
 return '<?php
433 433
 
434 434
 include_once \''.$tester.'\';
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
  */
451 451
 class PradoCommandLinePhpShell extends PradoCommandLineAction
452 452
 {
453
-	protected $action = 'shell';
454
-	protected $parameters = array();
455
-	protected $optional = array('directory');
456
-	protected $description = 'Runs a PHP interactive interpreter. Initializes the Prado application in the given [directory].';
453
+	protected $action='shell';
454
+	protected $parameters=array();
455
+	protected $optional=array('directory');
456
+	protected $description='Runs a PHP interactive interpreter. Initializes the Prado application in the given [directory].';
457 457
 
458 458
 	public function performAction($args)
459 459
 	{
@@ -473,23 +473,23 @@  discard block
 block discarded – undo
473 473
  */
474 474
 class PradoCommandLineActiveRecordGen extends PradoCommandLineAction
475 475
 {
476
-	protected $action = 'generate';
477
-	protected $parameters = array('table', 'output');
478
-	protected $optional = array('directory', 'soap');
479
-	protected $description = 'Generate Active Record skeleton for <table> to <output> file using application.xml in [directory]. May also generate [soap] properties.';
476
+	protected $action='generate';
477
+	protected $parameters=array('table', 'output');
478
+	protected $optional=array('directory', 'soap');
479
+	protected $description='Generate Active Record skeleton for <table> to <output> file using application.xml in [directory]. May also generate [soap] properties.';
480 480
 	private $_soap=false;
481 481
 
482 482
 	public function performAction($args)
483 483
 	{
484
-		$app_dir = count($args) > 3 ? $this->getAppDir($args[3]) : $this->getAppDir();
485
-		$this->_soap = count($args) > 4;
486
-		if($app_dir !== false)
484
+		$app_dir=count($args) > 3 ? $this->getAppDir($args[3]) : $this->getAppDir();
485
+		$this->_soap=count($args) > 4;
486
+		if($app_dir!==false)
487 487
 		{
488
-			$config = $this->getActiveRecordConfig($app_dir);
489
-			$output = $this->getOutputFile($app_dir, $args[2]);
488
+			$config=$this->getActiveRecordConfig($app_dir);
489
+			$output=$this->getOutputFile($app_dir, $args[2]);
490 490
 			if(is_file($output))
491 491
 				echo "** File $output already exists, skiping. \n";
492
-			else if($config !== false && $output !== false)
492
+			else if($config!==false && $output!==false)
493 493
 				$this->generateActiveRecord($config, $args[1], $output);
494 494
 		}
495 495
 		return true;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	{
500 500
 		if(is_dir($dir))
501 501
 			return realpath($dir);
502
-		if(false !== ($app_dir = realpath($dir.'/protected/')) && is_dir($app_dir))
502
+		if(false!==($app_dir=realpath($dir.'/protected/')) && is_dir($app_dir))
503 503
 			return $app_dir;
504 504
 		echo '** Unable to find directory "'.$dir."\".\n";
505 505
 		return false;
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
 
508 508
 	protected function getXmlFile($app_dir)
509 509
 	{
510
-		if(false !== ($xml = realpath($app_dir.'/application.xml')) && is_file($xml))
510
+		if(false!==($xml=realpath($app_dir.'/application.xml')) && is_file($xml))
511 511
 			return $xml;
512
-		if(false !== ($xml = realpath($app_dir.'/protected/application.xml')) && is_file($xml))
512
+		if(false!==($xml=realpath($app_dir.'/protected/application.xml')) && is_file($xml))
513 513
 			return $xml;
514 514
 		echo '** Unable to find application.xml in '.$app_dir."\n";
515 515
 		return false;
@@ -517,9 +517,9 @@  discard block
 block discarded – undo
517 517
 
518 518
 	protected function getActiveRecordConfig($app_dir)
519 519
 	{
520
-		if(false === ($xml=$this->getXmlFile($app_dir)))
520
+		if(false===($xml=$this->getXmlFile($app_dir)))
521 521
 			return false;
522
-		if(false !== ($app=$this->initializePradoApplication($app_dir)))
522
+		if(false!==($app=$this->initializePradoApplication($app_dir)))
523 523
 		{
524 524
 			Prado::using('System.Data.ActiveRecord.TActiveRecordConfig');
525 525
 			foreach($app->getModules() as $module)
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	{
535 535
 		if(is_file($namespace) && strpos($namespace, $app_dir)===0)
536 536
 				return $namespace;
537
-		$file = Prado::getPathOfNamespace($namespace, ".php");
538
-		if($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path))
537
+		$file=Prado::getPathOfNamespace($namespace, ".php");
538
+		if($file!==null && false!==($path=realpath(dirname($file))) && is_dir($path))
539 539
 		{
540 540
 			if(strpos($path, $app_dir)===0)
541 541
 				return $file;
@@ -546,24 +546,24 @@  discard block
 block discarded – undo
546 546
 
547 547
 	protected function generateActiveRecord($config, $tablename, $output)
548 548
 	{
549
-		$manager = TActiveRecordManager::getInstance();
549
+		$manager=TActiveRecordManager::getInstance();
550 550
 		if($manager->getDbConnection()) {
551
-			$gateway = $manager->getRecordGateway();
552
-			$tableInfo = $gateway->getTableInfo($manager->getDbConnection(), $tablename);
553
-			if(count($tableInfo->getColumns()) === 0)
551
+			$gateway=$manager->getRecordGateway();
552
+			$tableInfo=$gateway->getTableInfo($manager->getDbConnection(), $tablename);
553
+			if(count($tableInfo->getColumns())===0)
554 554
 			{
555 555
 				echo '** Unable to find table or view "'.$tablename.'" in "'.$manager->getDbConnection()->getConnectionString()."\".\n";
556 556
 				return false;
557 557
 			}
558 558
 			else
559 559
 			{
560
-				$properties = array();
560
+				$properties=array();
561 561
 				foreach($tableInfo->getColumns() as $field=>$column)
562
-					$properties[] = $this->generateProperty($field,$column);
562
+					$properties[]=$this->generateProperty($field, $column);
563 563
 			}
564 564
 
565
-			$classname = basename($output, '.php');
566
-			$class = $this->generateClass($properties, $tablename, $classname);
565
+			$classname=basename($output, '.php');
566
+			$class=$this->generateClass($properties, $tablename, $classname);
567 567
 			echo "  Writing class $classname to file $output\n";
568 568
 			file_put_contents($output, $class);
569 569
 		} else {
@@ -571,14 +571,14 @@  discard block
 block discarded – undo
571 571
 		}
572 572
 	}
573 573
 
574
-	protected function generateProperty($field,$column)
574
+	protected function generateProperty($field, $column)
575 575
 	{
576
-		$prop = '';
577
-		$name = '$'.$field;
578
-		$type = $column->getPHPType();
576
+		$prop='';
577
+		$name='$'.$field;
578
+		$type=$column->getPHPType();
579 579
 		if($this->_soap)
580 580
 		{
581
-			$prop .= <<<EOD
581
+			$prop.=<<<EOD
582 582
 
583 583
 	/**
584 584
 	 * @var $type $name
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 
588 588
 EOD;
589 589
 		}
590
-		$prop .= "\tpublic $name;";
590
+		$prop.="\tpublic $name;";
591 591
 		return $prop;
592 592
 	}
593 593
 
594 594
 	protected function generateClass($properties, $tablename, $class)
595 595
 	{
596
-		$props = implode("\n", $properties);
597
-		$date = date('Y-m-d h:i:s');
596
+		$props=implode("\n", $properties);
597
+		$date=date('Y-m-d h:i:s');
598 598
 return <<<EOD
599 599
 <?php
600 600
 /**
@@ -625,38 +625,38 @@  discard block
 block discarded – undo
625 625
  */
626 626
 class PradoCommandLineActiveRecordGenAll extends PradoCommandLineAction
627 627
 {
628
-    protected $action = 'generateAll';
629
-    protected $parameters = array('output');
630
-    protected $optional = array('directory', 'soap', 'overwrite', 'prefix', 'postfix');
631
-    protected $description = "Generate Active Record skeleton for all Tables to <output> file using application.xml in [directory]. May also generate [soap] properties.\nGenerated Classes are named like the Table with optional [Prefix] and/or [Postfix]. [Overwrite] is used to overwrite existing Files.";
632
-    private $_soap = false;
633
-    private $_prefix = '';
634
-    private $_postfix = '';
635
-    private $_overwrite = false;
628
+    protected $action='generateAll';
629
+    protected $parameters=array('output');
630
+    protected $optional=array('directory', 'soap', 'overwrite', 'prefix', 'postfix');
631
+    protected $description="Generate Active Record skeleton for all Tables to <output> file using application.xml in [directory]. May also generate [soap] properties.\nGenerated Classes are named like the Table with optional [Prefix] and/or [Postfix]. [Overwrite] is used to overwrite existing Files.";
632
+    private $_soap=false;
633
+    private $_prefix='';
634
+    private $_postfix='';
635
+    private $_overwrite=false;
636 636
 
637 637
     public function performAction($args) {
638
-        $app_dir = count($args) > 2 ? $this->getAppDir($args[2]) : $this->getAppDir();
639
-        $this->_soap = count($args) > 3 ? ($args[3] == "soap" || $args[3] == "true" ? true : false) : false;
640
-        $this->_overwrite = count($args) > 4 ? ($args[4] == "overwrite" || $args[4] == "true" ? true : false) : false;
641
-        $this->_prefix = count($args) > 5 ? $args[5] : '';
642
-        $this->_postfix = count($args) > 6 ? $args[6] : '';
638
+        $app_dir=count($args) > 2 ? $this->getAppDir($args[2]) : $this->getAppDir();
639
+        $this->_soap=count($args) > 3 ? ($args[3]=="soap" || $args[3]=="true" ? true : false) : false;
640
+        $this->_overwrite=count($args) > 4 ? ($args[4]=="overwrite" || $args[4]=="true" ? true : false) : false;
641
+        $this->_prefix=count($args) > 5 ? $args[5] : '';
642
+        $this->_postfix=count($args) > 6 ? $args[6] : '';
643 643
 
644
-        if ($app_dir !== false) {
645
-            $config = $this->getActiveRecordConfig($app_dir);
644
+        if($app_dir!==false) {
645
+            $config=$this->getActiveRecordConfig($app_dir);
646 646
 
647
-            $manager = TActiveRecordManager::getInstance();
648
-            $con = $manager->getDbConnection();
649
-            $con->Active = true;
647
+            $manager=TActiveRecordManager::getInstance();
648
+            $con=$manager->getDbConnection();
649
+            $con->Active=true;
650 650
 
651 651
             switch($con->getDriverName())
652 652
            	{
653 653
 				case 'mysqli':
654 654
 				case 'mysql':
655
-					$command = $con->createCommand("SHOW TABLES");
655
+					$command=$con->createCommand("SHOW TABLES");
656 656
 					break;
657 657
 				case 'sqlite': //sqlite 3
658 658
 				case 'sqlite2': //sqlite 2
659
-					$command = $con->createCommand("SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'");
659
+					$command=$con->createCommand("SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'");
660 660
 					break;
661 661
 				case 'pgsql':
662 662
 				case 'mssql': // Mssql driver on windows hosts
@@ -669,17 +669,17 @@  discard block
 block discarded – undo
669 669
 					
670 670
            	}
671 671
 
672
-            $dataReader = $command->query();
672
+            $dataReader=$command->query();
673 673
             $dataReader->bindColumn(1, $table);
674
-            $tables = array();
675
-            while ($dataReader->read() !== false) {
676
-                $tables[] = $table;
674
+            $tables=array();
675
+            while($dataReader->read()!==false) {
676
+                $tables[]=$table;
677 677
             }
678
-            $con->Active = False;
679
-            foreach ($tables as $key => $table) {
680
-                $output = $args[1] . "." . $this->_prefix . ucfirst($table) . $this->_postfix;
681
-                if ($config !== false && $output !== false) {
682
-                    $this->generate("generate " . $table . " " . $output . " " . $this->_soap . " " . $this->_overwrite);
678
+            $con->Active=False;
679
+            foreach($tables as $key => $table) {
680
+                $output=$args[1].".".$this->_prefix.ucfirst($table).$this->_postfix;
681
+                if($config!==false && $output!==false) {
682
+                    $this->generate("generate ".$table." ".$output." ".$this->_soap." ".$this->_overwrite);
683 683
                 }
684 684
             }
685 685
         }
@@ -688,16 +688,16 @@  discard block
 block discarded – undo
688 688
 
689 689
     public function generate($l)
690 690
     {
691
-		$input = explode(" ", trim($l));
691
+		$input=explode(" ", trim($l));
692 692
 		if(count($input) > 2)
693 693
 		{
694
-			$app_dir = '.';
694
+			$app_dir='.';
695 695
 			if(Prado::getApplication()!==null)
696
-				$app_dir = dirname(Prado::getApplication()->getBasePath());
697
-			$args = array($input[0],$input[1], $input[2],$app_dir);
698
-			if(count($input)>3)
699
-				$args = array($input[0],$input[1], $input[2],$app_dir,'soap');
700
-			$cmd = new PradoCommandLineActiveRecordGen;
696
+				$app_dir=dirname(Prado::getApplication()->getBasePath());
697
+			$args=array($input[0], $input[1], $input[2], $app_dir);
698
+			if(count($input) > 3)
699
+				$args=array($input[0], $input[1], $input[2], $app_dir, 'soap');
700
+			$cmd=new PradoCommandLineActiveRecordGen;
701 701
 			$cmd->performAction($args);
702 702
 		}
703 703
 		else
@@ -707,45 +707,45 @@  discard block
 block discarded – undo
707 707
     }
708 708
 
709 709
     protected function getAppDir($dir=".") {
710
-        if (is_dir($dir))
710
+        if(is_dir($dir))
711 711
             return realpath($dir);
712
-        if (false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir))
712
+        if(false!==($app_dir=realpath($dir.'/protected/')) && is_dir($app_dir))
713 713
             return $app_dir;
714
-        echo '** Unable to find directory "' . $dir . "\".\n";
714
+        echo '** Unable to find directory "'.$dir."\".\n";
715 715
         return false;
716 716
     }
717 717
 
718 718
     protected function getXmlFile($app_dir) {
719
-        if (false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml))
719
+        if(false!==($xml=realpath($app_dir.'/application.xml')) && is_file($xml))
720 720
             return $xml;
721
-        if (false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml))
721
+        if(false!==($xml=realpath($app_dir.'/protected/application.xml')) && is_file($xml))
722 722
             return $xml;
723
-        echo '** Unable to find application.xml in ' . $app_dir . "\n";
723
+        echo '** Unable to find application.xml in '.$app_dir."\n";
724 724
         return false;
725 725
     }
726 726
 
727 727
     protected function getActiveRecordConfig($app_dir) {
728
-        if (false === ($xml = $this->getXmlFile($app_dir)))
728
+        if(false===($xml=$this->getXmlFile($app_dir)))
729 729
             return false;
730
-        if (false !== ($app = $this->initializePradoApplication($app_dir))) {
730
+        if(false!==($app=$this->initializePradoApplication($app_dir))) {
731 731
             Prado::using('System.Data.ActiveRecord.TActiveRecordConfig');
732
-            foreach ($app->getModules() as $module)
733
-                if ($module instanceof TActiveRecordConfig)
732
+            foreach($app->getModules() as $module)
733
+                if($module instanceof TActiveRecordConfig)
734 734
                     return $module;
735
-            echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n";
735
+            echo '** Unable to find TActiveRecordConfig module in '.$xml."\n";
736 736
         }
737 737
         return false;
738 738
     }
739 739
 
740 740
     protected function getOutputFile($app_dir, $namespace) {
741
-        if (is_file($namespace) && strpos($namespace, $app_dir) === 0)
741
+        if(is_file($namespace) && strpos($namespace, $app_dir)===0)
742 742
             return $namespace;
743
-        $file = Prado::getPathOfNamespace($namespace, "");
744
-        if ($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) {
745
-            if (strpos($path, $app_dir) === 0)
743
+        $file=Prado::getPathOfNamespace($namespace, "");
744
+        if($file!==null && false!==($path=realpath(dirname($file))) && is_dir($path)) {
745
+            if(strpos($path, $app_dir)===0)
746 746
                 return $file;
747 747
         }
748
-        echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n";
748
+        echo '** Output file '.$file.' must be within directory '.$app_dir."\n";
749 749
         return false;
750 750
     }
751 751
 
Please login to merge, or discard this patch.