Completed
Push — fix_585 ( 4bfff7...8a5897 )
by Fabio
11:05
created
framework/TComponent.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TComponent, TPropertyValue classes
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- *
7
- * Global Events, intra-object events, Class behaviors, expanded behaviors
8
- * @author Brad Anderson <[email protected]>
9
- *
10
- * @link https://github.com/pradosoft/prado
11
- * @copyright Copyright &copy; 2005-2016 The PRADO Group
12
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
13
- * @package System
14
- */
3
+	 * TComponent, TPropertyValue classes
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 *
7
+	 * Global Events, intra-object events, Class behaviors, expanded behaviors
8
+	 * @author Brad Anderson <[email protected]>
9
+	 *
10
+	 * @link https://github.com/pradosoft/prado
11
+	 * @copyright Copyright &copy; 2005-2016 The PRADO Group
12
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
13
+	 * @package System
14
+	 */
15 15
 
16 16
 /**
17 17
  * TComponent class
Please login to merge, or discard this patch.
Spacing   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * that start with 'fx' are filtered in.
374 374
 	 */
375 375
 	private function filter_prado_fx($name) {
376
-		return strncasecmp($name,'fx',2)===0;
376
+		return strncasecmp($name, 'fx', 2)===0;
377 377
 	}
378 378
 
379 379
 
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
 	 * @param boolean optional should the names be all lowercase true/false
384 384
 	 * @return array array of strings being the class hierarchy of $this.
385 385
 	 */
386
-	public function getClassHierarchy($lowercase = false)
386
+	public function getClassHierarchy($lowercase=false)
387 387
 	{
388 388
 		$class=get_class($this);
389 389
 		$classes=array($class);
390
-		while($class=get_parent_class($class)){array_unshift($classes,$class);}
390
+		while($class=get_parent_class($class)) {array_unshift($classes, $class); }
391 391
 		if($lowercase)
392
-			return array_map('strtolower',$classes);
392
+			return array_map('strtolower', $classes);
393 393
 		return $classes;
394 394
 	}
395 395
 
@@ -412,14 +412,14 @@  discard block
 block discarded – undo
412 412
 		if($this->_listeningenabled)
413 413
 			return;
414 414
 
415
-		$fx=array_filter(get_class_methods($this),array($this,'filter_prado_fx'));
415
+		$fx=array_filter(get_class_methods($this), array($this, 'filter_prado_fx'));
416 416
 
417 417
 		foreach($fx as $func)
418
-			$this->attachEventHandler($func,array($this,$func));
418
+			$this->attachEventHandler($func, array($this, $func));
419 419
 
420
-		if(is_a($this,'IDynamicMethods')) {
421
-			$this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER,array($this,'__dycall'));
422
-			array_push($fx,TComponent::GLOBAL_RAISE_EVENT_LISTENER);
420
+		if(is_a($this, 'IDynamicMethods')) {
421
+			$this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($this, '__dycall'));
422
+			array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER);
423 423
 		}
424 424
 
425 425
 		$this->_listeningenabled=true;
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
 		if(!$this->_listeningenabled)
447 447
 			return;
448 448
 
449
-		$fx=array_filter(get_class_methods($this),array($this,'filter_prado_fx'));
449
+		$fx=array_filter(get_class_methods($this), array($this, 'filter_prado_fx'));
450 450
 
451 451
 		foreach($fx as $func)
452
-			$this->detachEventHandler($func,array($this,$func));
452
+			$this->detachEventHandler($func, array($this, $func));
453 453
 
454
-		if(is_a($this,'IDynamicMethods')) {
455
-			$this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER,array($this,'__dycall'));
456
-			array_push($fx,TComponent::GLOBAL_RAISE_EVENT_LISTENER);
454
+		if(is_a($this, 'IDynamicMethods')) {
455
+			$this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($this, '__dycall'));
456
+			array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER);
457 457
 		}
458 458
 
459 459
 		$this->_listeningenabled=false;
@@ -498,66 +498,66 @@  discard block
 block discarded – undo
498 498
 	 */
499 499
 	public function __call($method, $args)
500 500
 	{
501
-		$getset=substr($method,0,3);
502
-		if(($getset=='get')||($getset=='set'))
501
+		$getset=substr($method, 0, 3);
502
+		if(($getset=='get') || ($getset=='set'))
503 503
 		{
504
-			$propname=substr($method,3);
504
+			$propname=substr($method, 3);
505 505
 			$jsmethod=$getset.'js'.$propname;
506
-			if(method_exists($this,$jsmethod))
506
+			if(method_exists($this, $jsmethod))
507 507
 			{
508
-				if(count($args)>0)
509
-					if($args[0]&&!($args[0] instanceof TJavaScriptString))
508
+				if(count($args) > 0)
509
+					if($args[0] && !($args[0] instanceof TJavaScriptString))
510 510
 						$args[0]=new TJavaScriptString($args[0]);
511
-				return call_user_func_array(array($this,$jsmethod),$args);
511
+				return call_user_func_array(array($this, $jsmethod), $args);
512 512
 			}
513 513
 
514
-			if (($getset=='set')&&method_exists($this,'getjs'.$propname))
515
-				throw new TInvalidOperationException('component_property_readonly',get_class($this),$method);
514
+			if(($getset=='set') && method_exists($this, 'getjs'.$propname))
515
+				throw new TInvalidOperationException('component_property_readonly', get_class($this), $method);
516 516
 		}
517 517
 
518
-		if($this->_m!==null&&$this->_behaviorsenabled)
518
+		if($this->_m!==null && $this->_behaviorsenabled)
519 519
 		{
520
-			if(strncasecmp($method,'dy',2)===0)
520
+			if(strncasecmp($method, 'dy', 2)===0)
521 521
 			{
522 522
 				$callchain=new TCallChain($method);
523 523
 				foreach($this->_m->toArray() as $behavior)
524 524
 				{
525
-					if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&(method_exists($behavior,$method)||($behavior instanceof IDynamicMethods)))
525
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && (method_exists($behavior, $method) || ($behavior instanceof IDynamicMethods)))
526 526
 					{
527 527
 						$behavior_args=$args;
528 528
 						if($behavior instanceof IClassBehavior)
529
-							array_unshift($behavior_args,$this);
530
-						$callchain->addCall(array($behavior,$method),$behavior_args);
529
+							array_unshift($behavior_args, $this);
530
+						$callchain->addCall(array($behavior, $method), $behavior_args);
531 531
 					}
532 532
 
533 533
 				}
534
-				if($callchain->getCount()>0)
535
-					return call_user_func_array(array($callchain,'call'),$args);
534
+				if($callchain->getCount() > 0)
535
+					return call_user_func_array(array($callchain, 'call'), $args);
536 536
 			}
537 537
 			else
538 538
 			{
539 539
 				foreach($this->_m->toArray() as $behavior)
540 540
 				{
541
-					if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&method_exists($behavior,$method))
541
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && method_exists($behavior, $method))
542 542
 					{
543 543
 						if($behavior instanceof IClassBehavior)
544
-							array_unshift($args,$this);
545
-						return call_user_func_array(array($behavior,$method),$args);
544
+							array_unshift($args, $this);
545
+						return call_user_func_array(array($behavior, $method), $args);
546 546
 					}
547 547
 				}
548 548
 			}
549 549
 		}
550 550
 
551
-		if(strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0)
551
+		if(strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0)
552 552
 		{
553 553
 			if($this instanceof IDynamicMethods)
554
-				return $this->__dycall($method,$args);
555
-			return isset($args[0])?$args[0]:null;
554
+				return $this->__dycall($method, $args);
555
+			return isset($args[0]) ? $args[0] : null;
556 556
 		}
557 557
 
558 558
 		// don't thrown an exception for __magicMethods() or any other weird methods natively implemented by php
559
-		if (!method_exists($this, $method)) {
560
-			throw new TApplicationException('component_method_undefined',get_class($this),$method);
559
+		if(!method_exists($this, $method)) {
560
+			throw new TApplicationException('component_method_undefined', get_class($this), $method);
561 561
 		}
562 562
 	}
563 563
 
@@ -587,17 +587,17 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	public function __get($name)
589 589
 	{
590
-		if(method_exists($this,$getter='get'.$name))
590
+		if(method_exists($this, $getter='get'.$name))
591 591
 		{
592 592
 			// getting a property
593 593
 			return $this->$getter();
594 594
 		}
595
-		else if(method_exists($this,$jsgetter='getjs'.$name))
595
+		else if(method_exists($this, $jsgetter='getjs'.$name))
596 596
 		{
597 597
 			// getting a javascript property
598
-			return (string)$this->$jsgetter();
598
+			return (string) $this->$jsgetter();
599 599
 		}
600
-		else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name))
600
+		else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name))
601 601
 		{
602 602
 			// getting an event (handler list)
603 603
 			$name=strtolower($name);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 				$this->_e[$name]=new TPriorityList;
606 606
 			return $this->_e[$name];
607 607
 		}
608
-		else if(strncasecmp($name,'fx',2)===0)
608
+		else if(strncasecmp($name, 'fx', 2)===0)
609 609
 		{
610 610
 			// getting a global event (handler list)
611 611
 			$name=strtolower($name);
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
 			{
623 623
 				foreach($this->_m->toArray() as $behavior)
624 624
 				{
625
-					if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&
626
-						(property_exists($behavior,$name)||$behavior->canGetProperty($name)||$behavior->hasEvent($name)))
625
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
626
+						(property_exists($behavior, $name) || $behavior->canGetProperty($name) || $behavior->hasEvent($name)))
627 627
 						return $behavior->$name;
628 628
 				}
629 629
 			}
630 630
 		}
631
-		throw new TInvalidOperationException('component_property_undefined',get_class($this),$name);
631
+		throw new TInvalidOperationException('component_property_undefined', get_class($this), $name);
632 632
 	}
633 633
 
634 634
 	/**
@@ -646,31 +646,31 @@  discard block
 block discarded – undo
646 646
 	 * @param mixed the property value or event handler
647 647
 	 * @throws TInvalidOperationException If the property is not defined or read-only.
648 648
 	 */
649
-	public function __set($name,$value)
649
+	public function __set($name, $value)
650 650
 	{
651
-		if(method_exists($this,$setter='set'.$name))
651
+		if(method_exists($this, $setter='set'.$name))
652 652
 		{
653
-			if(strncasecmp($name,'js',2)===0&&$value&&!($value instanceof TJavaScriptLiteral))
654
-				$value = new TJavaScriptLiteral($value);
653
+			if(strncasecmp($name, 'js', 2)===0 && $value && !($value instanceof TJavaScriptLiteral))
654
+				$value=new TJavaScriptLiteral($value);
655 655
 			return $this->$setter($value);
656 656
 		}
657
-		else if(method_exists($this,$jssetter='setjs'.$name))
657
+		else if(method_exists($this, $jssetter='setjs'.$name))
658 658
 		{
659
-			if($value&&!($value instanceof TJavaScriptString))
659
+			if($value && !($value instanceof TJavaScriptString))
660 660
 				$value=new TJavaScriptString($value);
661 661
 			return $this->$jssetter($value);
662 662
 		}
663
-		else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0)
663
+		else if((strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2)===0)
664 664
 		{
665
-			return $this->attachEventHandler($name,$value);
665
+			return $this->attachEventHandler($name, $value);
666 666
 		}
667
-		else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled)
667
+		else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
668 668
 		{
669 669
 			$sets=0;
670 670
 			foreach($this->_m->toArray() as $behavior)
671 671
 			{
672
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&
673
-					(property_exists($behavior,$name)||$behavior->canSetProperty($name)||$behavior->hasEvent($name))) {
672
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) &&
673
+					(property_exists($behavior, $name) || $behavior->canSetProperty($name) || $behavior->hasEvent($name))) {
674 674
 					$behavior->$name=$value;
675 675
 					$sets++;
676 676
 				}
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 
680 680
 		}
681 681
 
682
-		if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name))
682
+		if(method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name))
683 683
 		{
684
-			throw new TInvalidOperationException('component_property_readonly',get_class($this),$name);
684
+			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
685 685
 		}
686 686
 		else
687 687
 		{
688
-			throw new TInvalidOperationException('component_property_undefined',get_class($this),$name);
688
+			throw new TInvalidOperationException('component_property_undefined', get_class($this), $name);
689 689
 		}
690 690
 	}
691 691
 
@@ -703,27 +703,27 @@  discard block
 block discarded – undo
703 703
 	 */
704 704
 	public function __isset($name)
705 705
 	{
706
-		if(method_exists($this,$getter='get'.$name))
706
+		if(method_exists($this, $getter='get'.$name))
707 707
 			return $this->$getter()!==null;
708
-		else if(method_exists($this,$jsgetter='getjs'.$name))
708
+		else if(method_exists($this, $jsgetter='getjs'.$name))
709 709
 			return $this->$jsgetter()!==null;
710
-		else if(strncasecmp($name,'on',2)===0&&method_exists($this,$name))
710
+		else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name))
711 711
 		{
712 712
 			$name=strtolower($name);
713
-			return isset($this->_e[$name])&&$this->_e[$name]->getCount();
713
+			return isset($this->_e[$name]) && $this->_e[$name]->getCount();
714 714
 		}
715
-		else if(strncasecmp($name,'fx',2)===0)
715
+		else if(strncasecmp($name, 'fx', 2)===0)
716 716
 		{
717 717
 			$name=strtolower($name);
718
-			return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount();
718
+			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount();
719 719
 		}
720
-		else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled)
720
+		else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
721 721
 		{
722 722
 			if(isset($this->_m[$name]))
723 723
 				return true;
724 724
 			foreach($this->_m->toArray() as $behavior)
725 725
 			{
726
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled()))
726
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()))
727 727
 					return isset($behavior->$name);
728 728
 			}
729 729
 
@@ -744,15 +744,15 @@  discard block
 block discarded – undo
744 744
 	 */
745 745
 	public function __unset($name)
746 746
 	{
747
-		if(method_exists($this,$setter='set'.$name))
747
+		if(method_exists($this, $setter='set'.$name))
748 748
 			$this->$setter(null);
749
-		else if(method_exists($this,$jssetter='setjs'.$name))
749
+		else if(method_exists($this, $jssetter='setjs'.$name))
750 750
 			$this->$jssetter(null);
751
-		else if(strncasecmp($name,'on',2)===0&&method_exists($this,$name))
751
+		else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name))
752 752
 			$this->_e[strtolower($name)]->clear();
753
-		else if(strncasecmp($name,'fx',2)===0)
753
+		else if(strncasecmp($name, 'fx', 2)===0)
754 754
 			$this->getEventHandlers($name)->remove(array($this, $name));
755
-		else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled)
755
+		else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled)
756 756
 		{
757 757
 			if(isset($this->_m[$name]))
758 758
 				$this->detachBehavior($name);
@@ -760,16 +760,16 @@  discard block
 block discarded – undo
760 760
 				$unset=0;
761 761
 				foreach($this->_m->toArray() as $behavior)
762 762
 				{
763
-					if((!($behavior instanceof IBehavior)||$behavior->getEnabled())) {
763
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled())) {
764 764
 						unset($behavior->$name);
765 765
 						$unset++;
766 766
 					}
767 767
 				}
768
-				if(!$unset&&method_exists($this,'get'.$name))
769
-					throw new TInvalidOperationException('component_property_readonly',get_class($this),$name);
768
+				if(!$unset && method_exists($this, 'get'.$name))
769
+					throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
770 770
 			}
771
-		} else if(method_exists($this,'get'.$name))
772
-			throw new TInvalidOperationException('component_property_readonly',get_class($this),$name);
771
+		} else if(method_exists($this, 'get'.$name))
772
+			throw new TInvalidOperationException('component_property_readonly', get_class($this), $name);
773 773
 	}
774 774
 
775 775
 	/**
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function hasProperty($name)
783 783
 	{
784
-		return $this->canGetProperty($name)||$this->canSetProperty($name);
784
+		return $this->canGetProperty($name) || $this->canSetProperty($name);
785 785
 	}
786 786
 
787 787
 	/**
@@ -795,13 +795,13 @@  discard block
 block discarded – undo
795 795
 	 */
796 796
 	public function canGetProperty($name)
797 797
 	{
798
-		if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name))
798
+		if(method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name))
799 799
 			return true;
800
-		else if($this->_m!==null&&$this->_behaviorsenabled)
800
+		else if($this->_m!==null && $this->_behaviorsenabled)
801 801
 		{
802 802
 			foreach($this->_m->toArray() as $behavior)
803 803
 			{
804
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->canGetProperty($name))
804
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name))
805 805
 					return true;
806 806
 			}
807 807
 		}
@@ -819,13 +819,13 @@  discard block
 block discarded – undo
819 819
 	 */
820 820
 	public function canSetProperty($name)
821 821
 	{
822
-		if(method_exists($this,'set'.$name)||method_exists($this,'setjs'.$name))
822
+		if(method_exists($this, 'set'.$name) || method_exists($this, 'setjs'.$name))
823 823
 			return true;
824
-		else if($this->_m!==null&&$this->_behaviorsenabled)
824
+		else if($this->_m!==null && $this->_behaviorsenabled)
825 825
 		{
826 826
 			foreach($this->_m->toArray() as $behavior)
827 827
 			{
828
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->canSetProperty($name))
828
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name))
829 829
 					return true;
830 830
 			}
831 831
 		}
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	public function getSubProperty($path)
846 846
 	{
847 847
 		$object=$this;
848
-		foreach(explode('.',$path) as $property)
848
+		foreach(explode('.', $path) as $property)
849 849
 			$object=$object->$property;
850 850
 		return $object;
851 851
 	}
@@ -860,15 +860,15 @@  discard block
 block discarded – undo
860 860
 	 * @param string property path
861 861
 	 * @param mixed the property path value
862 862
 	 */
863
-	public function setSubProperty($path,$value)
863
+	public function setSubProperty($path, $value)
864 864
 	{
865 865
 		$object=$this;
866
-		if(($pos=strrpos($path,'.'))===false)
866
+		if(($pos=strrpos($path, '.'))===false)
867 867
 			$property=$path;
868 868
 		else
869 869
 		{
870
-			$object=$this->getSubProperty(substr($path,0,$pos));
871
-			$property=substr($path,$pos+1);
870
+			$object=$this->getSubProperty(substr($path, 0, $pos));
871
+			$property=substr($path, $pos + 1);
872 872
 		}
873 873
 		$object->$property=$value;
874 874
 	}
@@ -887,14 +887,14 @@  discard block
 block discarded – undo
887 887
 	 */
888 888
 	public function hasEvent($name)
889 889
 	{
890
-		if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0||strncasecmp($name,'dy',2)===0)
890
+		if((strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2)===0 || strncasecmp($name, 'dy', 2)===0)
891 891
 			return true;
892 892
 
893
-		else if($this->_m!==null&&$this->_behaviorsenabled)
893
+		else if($this->_m!==null && $this->_behaviorsenabled)
894 894
 		{
895 895
 			foreach($this->_m->toArray() as $behavior)
896 896
 			{
897
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEvent($name))
897
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
898 898
 					return true;
899 899
 			}
900 900
 		}
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
 	public function hasEventHandler($name)
912 912
 	{
913 913
 		$name=strtolower($name);
914
-		if(strncasecmp($name,'fx',2)===0)
915
-			return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount()>0;
914
+		if(strncasecmp($name, 'fx', 2)===0)
915
+			return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount() > 0;
916 916
 		else
917 917
 		{
918
-			if(isset($this->_e[$name])&&$this->_e[$name]->getCount()>0)
918
+			if(isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0)
919 919
 				return true;
920
-			else if($this->_m!==null&&$this->_behaviorsenabled) {
920
+			else if($this->_m!==null && $this->_behaviorsenabled) {
921 921
 				foreach($this->_m->toArray() as $behavior)
922 922
 				{
923
-					if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEventHandler($name))
923
+					if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name))
924 924
 						return true;
925 925
 				}
926 926
 			}
@@ -936,29 +936,29 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	public function getEventHandlers($name)
938 938
 	{
939
-		if(strncasecmp($name,'on',2)===0&&method_exists($this,$name))
939
+		if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name))
940 940
 		{
941 941
 			$name=strtolower($name);
942 942
 			if(!isset($this->_e[$name]))
943 943
 				$this->_e[$name]=new TPriorityList;
944 944
 			return $this->_e[$name];
945 945
 		}
946
-		else if(strncasecmp($name,'fx',2)===0)
946
+		else if(strncasecmp($name, 'fx', 2)===0)
947 947
 		{
948 948
 			$name=strtolower($name);
949 949
 			if(!isset(self::$_ue[$name]))
950 950
 				self::$_ue[$name]=new TPriorityList;
951 951
 			return self::$_ue[$name];
952 952
 		}
953
-		else if($this->_m!==null&&$this->_behaviorsenabled)
953
+		else if($this->_m!==null && $this->_behaviorsenabled)
954 954
 		{
955 955
 			foreach($this->_m->toArray() as $behavior)
956 956
 			{
957
-				if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEvent($name))
957
+				if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name))
958 958
 					return $behavior->getEventHandlers($name);
959 959
 			}
960 960
 		}
961
-		throw new TInvalidOperationException('component_event_undefined',get_class($this),$name);
961
+		throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
962 962
 	}
963 963
 
964 964
 	/**
@@ -1006,9 +1006,9 @@  discard block
 block discarded – undo
1006 1006
 	 * default priority of 10.0 within {@link TPriorityList}
1007 1007
 	 * @throws TInvalidOperationException if the event does not exist
1008 1008
 	 */
1009
-	public function attachEventHandler($name,$handler,$priority=null)
1009
+	public function attachEventHandler($name, $handler, $priority=null)
1010 1010
 	{
1011
-		$this->getEventHandlers($name)->add($handler,$priority);
1011
+		$this->getEventHandlers($name)->add($handler, $priority);
1012 1012
 	}
1013 1013
 
1014 1014
 	/**
@@ -1021,13 +1021,13 @@  discard block
 block discarded – undo
1021 1021
 	 * to an item of any priority within {@link TPriorityList}; null means the default priority
1022 1022
 	 * @return boolean if the removal is successful
1023 1023
 	 */
1024
-	public function detachEventHandler($name,$handler,$priority=false)
1024
+	public function detachEventHandler($name, $handler, $priority=false)
1025 1025
 	{
1026 1026
 		if($this->hasEventHandler($name))
1027 1027
 		{
1028 1028
 			try
1029 1029
 			{
1030
-				$this->getEventHandlers($name)->remove($handler,$priority);
1030
+				$this->getEventHandlers($name)->remove($handler, $priority);
1031 1031
 				return true;
1032 1032
 			}
1033 1033
 			catch(Exception $e)
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 	 * @throws TInvalidOperationException if the event is undefined
1110 1110
 	 * @throws TInvalidDataValueException If an event handler is invalid
1111 1111
 	 */
1112
-	public function raiseEvent($name,$sender,$param,$responsetype=null,$postfunction=null)
1112
+	public function raiseEvent($name, $sender, $param, $responsetype=null, $postfunction=null)
1113 1113
 	{
1114 1114
 		$p=$param;
1115 1115
 		if(is_callable($responsetype))
@@ -1124,90 +1124,90 @@  discard block
 block discarded – undo
1124 1124
 		$name=strtolower($name);
1125 1125
 		$responses=array();
1126 1126
 
1127
-		$name=$this->dyPreRaiseEvent($name,$sender,$param,$responsetype,$postfunction);
1127
+		$name=$this->dyPreRaiseEvent($name, $sender, $param, $responsetype, $postfunction);
1128 1128
 
1129
-		if($this->hasEventHandler($name)||$this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1129
+		if($this->hasEventHandler($name) || $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1130 1130
 		{
1131 1131
 			$handlers=$this->getEventHandlers($name);
1132 1132
 			$handlerArray=$handlers->toArray();
1133
-			if(strncasecmp($name,'fx',2)===0&&$this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1133
+			if(strncasecmp($name, 'fx', 2)===0 && $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER))
1134 1134
 			{
1135 1135
 				$globalhandlers=$this->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER);
1136
-				$handlerArray=array_merge($globalhandlers->toArrayBelowPriority(0),$handlerArray,$globalhandlers->toArrayAbovePriority(0));
1136
+				$handlerArray=array_merge($globalhandlers->toArrayBelowPriority(0), $handlerArray, $globalhandlers->toArrayAbovePriority(0));
1137 1137
 			}
1138 1138
 			$response=null;
1139 1139
 			foreach($handlerArray as $handler)
1140 1140
 			{
1141
-				if($this->dyIntraRaiseEventTestHandler($handler,$sender,$param,$name)===false)
1141
+				if($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name)===false)
1142 1142
 					continue;
1143 1143
 
1144 1144
 				if(is_string($handler))
1145 1145
 				{
1146
-					if(($pos=strrpos($handler,'.'))!==false)
1146
+					if(($pos=strrpos($handler, '.'))!==false)
1147 1147
 					{
1148
-						$object=$this->getSubProperty(substr($handler,0,$pos));
1149
-						$method=substr($handler,$pos+1);
1150
-						if(method_exists($object,$method)||strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0)
1148
+						$object=$this->getSubProperty(substr($handler, 0, $pos));
1149
+						$method=substr($handler, $pos + 1);
1150
+						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0)
1151 1151
 						{
1152 1152
 							if($method=='__dycall')
1153
-								$response=$object->__dycall($name,array($sender,$param,$name));
1153
+								$response=$object->__dycall($name, array($sender, $param, $name));
1154 1154
 							else
1155
-								$response=$object->$method($sender,$param,$name);
1155
+								$response=$object->$method($sender, $param, $name);
1156 1156
 						}
1157 1157
 						else
1158
-							throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler);
1158
+							throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler);
1159 1159
 					}
1160 1160
 					else
1161
-						$response=call_user_func($handler,$sender,$param,$name);
1161
+						$response=call_user_func($handler, $sender, $param, $name);
1162 1162
 				}
1163
-				else if(is_callable($handler,true))
1163
+				else if(is_callable($handler, true))
1164 1164
 				{
1165
-					list($object,$method)=$handler;
1165
+					list($object, $method)=$handler;
1166 1166
 					if(is_string($object))
1167
-						$response=call_user_func($handler,$sender,$param,$name);
1167
+						$response=call_user_func($handler, $sender, $param, $name);
1168 1168
 					else
1169 1169
 					{
1170
-						if(($pos=strrpos($method,'.'))!==false)
1170
+						if(($pos=strrpos($method, '.'))!==false)
1171 1171
 						{
1172
-							$object=$this->getSubProperty(substr($method,0,$pos));
1173
-							$method=substr($method,$pos+1);
1172
+							$object=$this->getSubProperty(substr($method, 0, $pos));
1173
+							$method=substr($method, $pos + 1);
1174 1174
 						}
1175
-						if(method_exists($object,$method)||strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0)
1175
+						if(method_exists($object, $method) || strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0)
1176 1176
 						{
1177 1177
 							if($method=='__dycall')
1178
-								$response=$object->__dycall($name,array($sender,$param,$name));
1178
+								$response=$object->__dycall($name, array($sender, $param, $name));
1179 1179
 							else
1180
-								$response=$object->$method($sender,$param,$name);
1180
+								$response=$object->$method($sender, $param, $name);
1181 1181
 						}
1182 1182
 						else
1183
-							throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler[1]);
1183
+							throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler[1]);
1184 1184
 					}
1185 1185
 				}
1186 1186
 				else
1187
-					throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,gettype($handler));
1187
+					throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, gettype($handler));
1188 1188
 
1189
-				$this->dyIntraRaiseEventPostHandler($name,$sender,$param,$handler,$response);
1189
+				$this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response);
1190 1190
 
1191 1191
 				if($postfunction)
1192
-					$response=call_user_func_array($postfunction,array($sender,$param,$this,$response));
1192
+					$response=call_user_func_array($postfunction, array($sender, $param, $this, $response));
1193 1193
 
1194
-				if($responsetype&TEventResults::EVENT_RESULT_ALL)
1195
-					$responses[]=array('sender'=>$sender,'param'=>$param,'response'=>$response);
1194
+				if($responsetype & TEventResults::EVENT_RESULT_ALL)
1195
+					$responses[]=array('sender'=>$sender, 'param'=>$param, 'response'=>$response);
1196 1196
 				else
1197 1197
 					$responses[]=$response;
1198 1198
 
1199
-				if($response!==null&&($responsetype&TEventResults::EVENT_RESULT_FEED_FORWARD))
1199
+				if($response!==null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD))
1200 1200
 					$param=$response;
1201 1201
 
1202 1202
 			}
1203 1203
 		}
1204
-		else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name))
1205
-			throw new TInvalidOperationException('component_event_undefined',get_class($this),$name);
1204
+		else if(strncasecmp($name, 'on', 2)===0 && !$this->hasEvent($name))
1205
+			throw new TInvalidOperationException('component_event_undefined', get_class($this), $name);
1206 1206
 
1207
-		if($responsetype&TEventResults::EVENT_RESULT_FILTER)
1207
+		if($responsetype & TEventResults::EVENT_RESULT_FILTER)
1208 1208
 			$responses=array_filter($responses);
1209 1209
 
1210
-		$responses=$this->dyPostRaiseEvent($responses,$name,$sender,$param,$responsetype,$postfunction);
1210
+		$responses=$this->dyPostRaiseEvent($responses, $name, $sender, $param, $responsetype, $postfunction);
1211 1211
 
1212 1212
 		return $responses;
1213 1213
 	}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 		}
1241 1241
 		catch(Exception $e)
1242 1242
 		{
1243
-			throw new TInvalidOperationException('component_expression_invalid',get_class($this),$expression,$e->getMessage());
1243
+			throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage());
1244 1244
 		}
1245 1245
 	}
1246 1246
 
@@ -1275,7 +1275,7 @@  discard block
 block discarded – undo
1275 1275
 		}
1276 1276
 		catch(Exception $e)
1277 1277
 		{
1278
-			throw new TInvalidOperationException('component_statements_invalid',get_class($this),$statements,$e->getMessage());
1278
+			throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage());
1279 1279
 		}
1280 1280
 	}
1281 1281
 
@@ -1335,9 +1335,9 @@  discard block
 block discarded – undo
1335 1335
 	 * @param $param TClassBehaviorEventParameter
1336 1336
 	 * @since 3.2.3
1337 1337
 	 */
1338
-	public function fxAttachClassBehavior($sender,$param) {
1339
-		if(in_array($param->getClass(),$this->getClassHierarchy(true)))
1340
-			return $this->attachBehavior($param->getName(),$param->getBehavior(),$param->getPriority());
1338
+	public function fxAttachClassBehavior($sender, $param) {
1339
+		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1340
+			return $this->attachBehavior($param->getName(), $param->getBehavior(), $param->getPriority());
1341 1341
 	}
1342 1342
 
1343 1343
 
@@ -1349,9 +1349,9 @@  discard block
 block discarded – undo
1349 1349
 	 * @param $param TClassBehaviorEventParameter
1350 1350
 	 * @since 3.2.3
1351 1351
 	 */
1352
-	public function fxDetachClassBehavior($sender,$param) {
1353
-		if(in_array($param->getClass(),$this->getClassHierarchy(true)))
1354
-			return $this->detachBehavior($param->getName(),$param->getPriority());
1352
+	public function fxDetachClassBehavior($sender, $param) {
1353
+		if(in_array($param->getClass(), $this->getClassHierarchy(true)))
1354
+			return $this->detachBehavior($param->getName(), $param->getPriority());
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1373,8 +1373,8 @@  discard block
 block discarded – undo
1373 1373
 	 * @throws TInvalidOperationException if the class behavior is already defined
1374 1374
 	 * @since 3.2.3
1375 1375
 	 */
1376
-	public static function attachClassBehavior($name,$behavior,$class=null,$priority=null) {
1377
-		if(!$class&&function_exists('get_called_class'))
1376
+	public static function attachClassBehavior($name, $behavior, $class=null, $priority=null) {
1377
+		if(!$class && function_exists('get_called_class'))
1378 1378
 			$class=get_called_class();
1379 1379
 		if(!$class)
1380 1380
 			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
 		if(empty(self::$_um[$class]))
1388 1388
 			self::$_um[$class]=array();
1389 1389
 		if(isset(self::$_um[$class][$name]))
1390
-			throw new TInvalidOperationException('component_class_behavior_defined',$class,$name);
1391
-		$param=new TClassBehaviorEventParameter($class,$name,$behavior,$priority);
1392
-		self::$_um[$class]=array($name=>$param)+self::$_um[$class];
1393
-		$behaviorObject=is_string($behavior)?new $behavior:$behavior;
1394
-		return $behaviorObject->raiseEvent('fxAttachClassBehavior',null,$param);
1390
+			throw new TInvalidOperationException('component_class_behavior_defined', $class, $name);
1391
+		$param=new TClassBehaviorEventParameter($class, $name, $behavior, $priority);
1392
+		self::$_um[$class]=array($name=>$param) + self::$_um[$class];
1393
+		$behaviorObject=is_string($behavior) ? new $behavior : $behavior;
1394
+		return $behaviorObject->raiseEvent('fxAttachClassBehavior', null, $param);
1395 1395
 	}
1396 1396
 
1397 1397
 
@@ -1407,8 +1407,8 @@  discard block
 block discarded – undo
1407 1407
 	 * not supplied as a parameter.
1408 1408
 	 * @since 3.2.3
1409 1409
 	 */
1410
-	public static function detachClassBehavior($name,$class=null,$priority=false) {
1411
-		if(!$class&&function_exists('get_called_class'))
1410
+	public static function detachClassBehavior($name, $class=null, $priority=false) {
1411
+		if(!$class && function_exists('get_called_class'))
1412 1412
 			$class=get_called_class();
1413 1413
 		if(!$class)
1414 1414
 			throw new TInvalidOperationException('component_no_class_provided_nor_late_binding');
@@ -1416,13 +1416,13 @@  discard block
 block discarded – undo
1416 1416
 		$class=strtolower($class);
1417 1417
 		if(!is_string($name))
1418 1418
 			$name=get_class($name);
1419
-		if(empty(self::$_um[$class])||!isset(self::$_um[$class][$name]))
1419
+		if(empty(self::$_um[$class]) || !isset(self::$_um[$class][$name]))
1420 1420
 			return false;
1421 1421
 		$param=self::$_um[$class][$name];
1422 1422
 		$behavior=$param->getBehavior();
1423 1423
 		unset(self::$_um[$class][$name]);
1424
-		$behaviorObject=is_string($behavior)?new $behavior:$behavior;
1425
-		return $behaviorObject->raiseEvent('fxDetachClassBehavior',null,$param);
1424
+		$behaviorObject=is_string($behavior) ? new $behavior : $behavior;
1425
+		return $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param);
1426 1426
 	}
1427 1427
 
1428 1428
 	/**
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 	 */
1435 1435
 	public function asa($behaviorname)
1436 1436
 	{
1437
-		return isset($this->_m[$behaviorname])?$this->_m[$behaviorname]:null;
1437
+		return isset($this->_m[$behaviorname]) ? $this->_m[$behaviorname] : null;
1438 1438
 	}
1439 1439
 
1440 1440
 	/**
@@ -1460,15 +1460,15 @@  discard block
 block discarded – undo
1460 1460
 	{
1461 1461
 		if($this instanceof $class)
1462 1462
 			return true;
1463
-		if($this->_m!==null&&$this->_behaviorsenabled)
1464
-			foreach($this->_m->toArray() as $behavior){
1465
-				if(($behavior instanceof IBehavior)&&!$behavior->getEnabled())
1463
+		if($this->_m!==null && $this->_behaviorsenabled)
1464
+			foreach($this->_m->toArray() as $behavior) {
1465
+				if(($behavior instanceof IBehavior) && !$behavior->getEnabled())
1466 1466
 					continue;
1467 1467
 
1468
-				$check = null;
1469
-				if(($behavior->isa('IInstanceCheck'))&&$check=$behavior->isinstanceof($class,$this))
1468
+				$check=null;
1469
+				if(($behavior->isa('IInstanceCheck')) && $check=$behavior->isinstanceof($class, $this))
1470 1470
 					return true;
1471
-				if($check===null&&($behavior->isa($class)))
1471
+				if($check===null && ($behavior->isa($class)))
1472 1472
 					return true;
1473 1473
 			}
1474 1474
 		return false;
@@ -1486,9 +1486,9 @@  discard block
 block discarded – undo
1486 1486
 	{
1487 1487
 		foreach($behaviors as $name=>$behavior)
1488 1488
 			if($behavior instanceof TClassBehaviorEventParameter)
1489
-				$this->attachBehavior($behavior->getName(),$behavior->getBehavior(),$behavior->getPriority());
1489
+				$this->attachBehavior($behavior->getName(), $behavior->getBehavior(), $behavior->getPriority());
1490 1490
 			else
1491
-				$this->attachBehavior($name,$behavior);
1491
+				$this->attachBehavior($name, $behavior);
1492 1492
 	}
1493 1493
 
1494 1494
 	/**
@@ -1505,9 +1505,9 @@  discard block
 block discarded – undo
1505 1505
 		{
1506 1506
 			foreach($behaviors as $name=>$behavior)
1507 1507
 				if($behavior instanceof TClassBehaviorEventParameter)
1508
-					$this->detachBehavior($behavior->getName(),$behavior->getPriority());
1508
+					$this->detachBehavior($behavior->getName(), $behavior->getPriority());
1509 1509
 				else
1510
-					$this->detachBehavior(is_string($behavior)?$behavior:$name);
1510
+					$this->detachBehavior(is_string($behavior) ? $behavior : $name);
1511 1511
 		}
1512 1512
 	}
1513 1513
 
@@ -1545,19 +1545,19 @@  discard block
 block discarded – undo
1545 1545
 	 * @return IBehavior the behavior object
1546 1546
 	 * @since 3.2.3
1547 1547
 	 */
1548
-	public function attachBehavior($name,$behavior,$priority=null)
1548
+	public function attachBehavior($name, $behavior, $priority=null)
1549 1549
 	{
1550 1550
 		if(is_string($behavior))
1551 1551
 			$behavior=Prado::createComponent($behavior);
1552 1552
 		if(!($behavior instanceof IBaseBehavior))
1553
-			throw new TInvalidDataTypeException('component_not_a_behavior',get_class($behavior));
1553
+			throw new TInvalidDataTypeException('component_not_a_behavior', get_class($behavior));
1554 1554
 		if($behavior instanceof IBehavior)
1555 1555
 			$behavior->setEnabled(true);
1556 1556
 		if($this->_m===null)
1557 1557
 			$this->_m=new TPriorityMap;
1558 1558
 		$behavior->attach($this);
1559
-		$this->dyAttachBehavior($name,$behavior);
1560
-		$this->_m->add($name,$behavior,$priority);
1559
+		$this->dyAttachBehavior($name, $behavior);
1560
+		$this->_m->add($name, $behavior, $priority);
1561 1561
 		return $behavior;
1562 1562
 	}
1563 1563
 
@@ -1578,14 +1578,14 @@  discard block
 block discarded – undo
1578 1578
 	 * @return IBehavior the detached behavior. Null if the behavior does not exist.
1579 1579
 	 * @since 3.2.3
1580 1580
 	 */
1581
-	public function detachBehavior($name,$priority=false)
1581
+	public function detachBehavior($name, $priority=false)
1582 1582
 	{
1583
-		if($this->_m!=null&&isset($this->_m[$name]))
1583
+		if($this->_m!=null && isset($this->_m[$name]))
1584 1584
 		{
1585 1585
 			$this->_m[$name]->detach($this);
1586 1586
 			$behavior=$this->_m->itemAt($name);
1587
-			$this->_m->remove($name,$priority);
1588
-			$this->dyDetachBehavior($name,$behavior);
1587
+			$this->_m->remove($name, $priority);
1588
+			$this->dyDetachBehavior($name, $behavior);
1589 1589
 			return $behavior;
1590 1590
 		}
1591 1591
 	}
@@ -1661,10 +1661,10 @@  discard block
 block discarded – undo
1661 1661
 	 */
1662 1662
 	public function enableBehavior($name)
1663 1663
 	{
1664
-		if($this->_m!=null&&isset($this->_m[$name])){
1664
+		if($this->_m!=null && isset($this->_m[$name])) {
1665 1665
 			if($this->_m[$name] instanceof IBehavior) {
1666 1666
 				$this->_m[$name]->setEnabled(true);
1667
-				$this->dyEnableBehavior($name,$this->_m[$name]);
1667
+				$this->dyEnableBehavior($name, $this->_m[$name]);
1668 1668
 				return true;
1669 1669
 			}
1670 1670
 			return false;
@@ -1689,10 +1689,10 @@  discard block
 block discarded – undo
1689 1689
 	 */
1690 1690
 	public function disableBehavior($name)
1691 1691
 	{
1692
-		if($this->_m!=null&&isset($this->_m[$name])){
1692
+		if($this->_m!=null && isset($this->_m[$name])) {
1693 1693
 			if($this->_m[$name] instanceof IBehavior) {
1694 1694
 				$this->_m[$name]->setEnabled(false);
1695
-				$this->dyDisableBehavior($name,$this->_m[$name]);
1695
+				$this->dyDisableBehavior($name, $this->_m[$name]);
1696 1696
 				return true;
1697 1697
 			}
1698 1698
 			return false;
@@ -1707,9 +1707,9 @@  discard block
 block discarded – undo
1707 1707
 	 */
1708 1708
 	public function __sleep()
1709 1709
 	{
1710
-		$a = (array)$this;
1711
-		$a = array_keys($a);
1712
-		$exprops = array();
1710
+		$a=(array) $this;
1711
+		$a=array_keys($a);
1712
+		$exprops=array();
1713 1713
 		$this->_getZappableSleepProps($exprops);
1714 1714
 		return array_diff($a, $exprops);
1715 1715
 	}
@@ -1723,13 +1723,13 @@  discard block
 block discarded – undo
1723 1723
 	protected function _getZappableSleepProps(&$exprops)
1724 1724
 	{
1725 1725
 		if($this->_listeningenabled===false)
1726
-			$exprops[] = "\0TComponent\0_listeningenabled";
1726
+			$exprops[]="\0TComponent\0_listeningenabled";
1727 1727
 		if($this->_behaviorsenabled===true)
1728
-			$exprops[] = "\0TComponent\0_behaviorsenabled";
1729
-		if ($this->_e===array())
1730
-			$exprops[] = "\0TComponent\0_e";
1731
-		if ($this->_m===null)
1732
-			$exprops[] = "\0TComponent\0_m";
1728
+			$exprops[]="\0TComponent\0_behaviorsenabled";
1729
+		if($this->_e===array())
1730
+			$exprops[]="\0TComponent\0_e";
1731
+		if($this->_m===null)
1732
+			$exprops[]="\0TComponent\0_m";
1733 1733
 	}
1734 1734
 }
1735 1735
 
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
  */
1746 1746
 interface IDynamicMethods
1747 1747
 {
1748
-	public function __dycall($method,$args);
1748
+	public function __dycall($method, $args);
1749 1749
 }
1750 1750
 
1751 1751
 
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 	 *	@param string $name the name of the behavior
1773 1773
 	 *	@param object $behavior this is the behavior to implement the class behavior
1774 1774
 	 */
1775
-	public function __construct($class,$name,$behavior,$priority)
1775
+	public function __construct($class, $name, $behavior, $priority)
1776 1776
 	{
1777 1777
 		$this->_class=$class;
1778 1778
 		$this->_name=$name;
@@ -1913,10 +1913,10 @@  discard block
 block discarded – undo
1913 1913
 	 */
1914 1914
 	public static function ensureBoolean($value)
1915 1915
 	{
1916
-		if (is_string($value))
1917
-			return strcasecmp($value,'true')==0 || $value!=0;
1916
+		if(is_string($value))
1917
+			return strcasecmp($value, 'true')==0 || $value!=0;
1918 1918
 		else
1919
-			return (boolean)$value;
1919
+			return (boolean) $value;
1920 1920
 	}
1921 1921
 
1922 1922
 	/**
@@ -1928,12 +1928,12 @@  discard block
 block discarded – undo
1928 1928
 	 */
1929 1929
 	public static function ensureString($value)
1930 1930
 	{
1931
-		if (TJavaScript::isJsLiteral($value))
1931
+		if(TJavaScript::isJsLiteral($value))
1932 1932
 			return $value;
1933
-		if (is_bool($value))
1934
-			return $value?'true':'false';
1933
+		if(is_bool($value))
1934
+			return $value ? 'true' : 'false';
1935 1935
 		else
1936
-			return (string)$value;
1936
+			return (string) $value;
1937 1937
 	}
1938 1938
 
1939 1939
 	/**
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 	 */
1944 1944
 	public static function ensureInteger($value)
1945 1945
 	{
1946
-		return (integer)$value;
1946
+		return (integer) $value;
1947 1947
 	}
1948 1948
 
1949 1949
 	/**
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	public static function ensureFloat($value)
1955 1955
 	{
1956
-		return (float)$value;
1956
+		return (float) $value;
1957 1957
 	}
1958 1958
 
1959 1959
 	/**
@@ -1969,18 +1969,18 @@  discard block
 block discarded – undo
1969 1969
 	{
1970 1970
 		if(is_string($value))
1971 1971
 		{
1972
-			$value = trim($value);
1973
-			$len = strlen($value);
1974
-			if ($len >= 2 && $value[0] == '(' && $value[$len-1] == ')')
1972
+			$value=trim($value);
1973
+			$len=strlen($value);
1974
+			if($len >= 2 && $value[0]=='(' && $value[$len - 1]==')')
1975 1975
 			{
1976 1976
 				eval('$array=array'.$value.';');
1977 1977
 				return $array;
1978 1978
 			}
1979 1979
 			else
1980
-				return $len>0?array($value):array();
1980
+				return $len > 0 ? array($value) : array();
1981 1981
 		}
1982 1982
 		else
1983
-			return (array)$value;
1983
+			return (array) $value;
1984 1984
 	}
1985 1985
 
1986 1986
 	/**
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 	 */
1991 1991
 	public static function ensureObject($value)
1992 1992
 	{
1993
-		return (object)$value;
1993
+		return (object) $value;
1994 1994
 	}
1995 1995
 
1996 1996
 	/**
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 	 * @return string the valid enumeration value
2010 2010
 	 * @throws TInvalidDataValueException if the original value is not in the string array.
2011 2011
 	 */
2012
-	public static function ensureEnum($value,$enums)
2012
+	public static function ensureEnum($value, $enums)
2013 2013
 	{
2014 2014
 		static $types=array();
2015 2015
 		if(func_num_args()===2 && is_string($enums))
@@ -2020,18 +2020,18 @@  discard block
 block discarded – undo
2020 2020
 				return $value;
2021 2021
 			else
2022 2022
 				throw new TInvalidDataValueException(
2023
-					'propertyvalue_enumvalue_invalid',$value,
2024
-						implode(' | ',$types[$enums]->getConstants()));
2023
+					'propertyvalue_enumvalue_invalid', $value,
2024
+						implode(' | ', $types[$enums]->getConstants()));
2025 2025
 		}
2026 2026
 		else if(!is_array($enums))
2027 2027
 		{
2028 2028
 			$enums=func_get_args();
2029 2029
 			array_shift($enums);
2030 2030
 		}
2031
-		if(in_array($value,$enums,true))
2031
+		if(in_array($value, $enums, true))
2032 2032
 			return $value;
2033 2033
 		else
2034
-			throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid',$value,implode(' | ',$enums));
2034
+			throw new TInvalidDataValueException('propertyvalue_enumvalue_invalid', $value, implode(' | ', $enums));
2035 2035
 	}
2036 2036
 
2037 2037
 	/**
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
 	 */
2042 2042
 	public static function ensureNullIfEmpty($value)
2043 2043
 	{
2044
-		return empty($value)?null:$value;
2044
+		return empty($value) ? null : $value;
2045 2045
 	}
2046 2046
 }
2047 2047
 
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
 	 */
2095 2095
 	public function __construct($component)
2096 2096
 	{
2097
-		if(is_string($component) && class_exists($component,false))
2097
+		if(is_string($component) && class_exists($component, false))
2098 2098
 			$this->_className=$component;
2099 2099
 		else if(is_object($component))
2100 2100
 			$this->_className=get_class($component);
@@ -2107,14 +2107,14 @@  discard block
 block discarded – undo
2107 2107
 	{
2108 2108
 		$methodName=$method->getName();
2109 2109
 		return $method->getNumberOfRequiredParameters()===0
2110
-				&& strncasecmp($methodName,'get',3)===0
2110
+				&& strncasecmp($methodName, 'get', 3)===0
2111 2111
 				&& isset($methodName[3]);
2112 2112
 	}
2113 2113
 
2114 2114
 	private function isEventMethod($method)
2115 2115
 	{
2116 2116
 		$methodName=$method->getName();
2117
-		return strncasecmp($methodName,'on',2)===0
2117
+		return strncasecmp($methodName, 'on', 2)===0
2118 2118
 				&& isset($methodName[2]);
2119 2119
 	}
2120 2120
 
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
 		$properties=array();
2125 2125
 		$events=array();
2126 2126
 		$methods=array();
2127
-		$isComponent=is_subclass_of($this->_className,'TComponent') || strcasecmp($this->_className,'TComponent')===0;
2127
+		$isComponent=is_subclass_of($this->_className, 'TComponent') || strcasecmp($this->_className, 'TComponent')===0;
2128 2128
 		foreach($class->getMethods() as $method)
2129 2129
 		{
2130 2130
 			if($method->isPublic() || $method->isProtected())
@@ -2133,14 +2133,14 @@  discard block
 block discarded – undo
2133 2133
 				if(!$method->isStatic() && $isComponent)
2134 2134
 				{
2135 2135
 					if($this->isPropertyMethod($method))
2136
-						$properties[substr($methodName,3)]=$method;
2136
+						$properties[substr($methodName, 3)]=$method;
2137 2137
 					else if($this->isEventMethod($method))
2138 2138
 					{
2139 2139
 						$methodName[0]='O';
2140 2140
 						$events[$methodName]=$method;
2141 2141
 					}
2142 2142
 				}
2143
-				if(strncmp($methodName,'__',2)!==0)
2143
+				if(strncmp($methodName, '__', 2)!==0)
2144 2144
 					$methods[$methodName]=$method;
2145 2145
 			}
2146 2146
 		}
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
 	protected function determinePropertyType($method)
2191 2191
 	{
2192 2192
 		$comment=$method->getDocComment();
2193
-		if(preg_match('/@return\\s+(.*?)\\s+/',$comment,$matches))
2193
+		if(preg_match('/@return\\s+(.*?)\\s+/', $comment, $matches))
2194 2194
 			return $matches[1];
2195 2195
 		else
2196 2196
 			return '{unknown}';
@@ -2348,7 +2348,7 @@  discard block
 block discarded – undo
2348 2348
 	 * @return boolean|null if the this or the instance is of type class.  When null, no information could be derived and
2349 2349
 	 * the default mechanisms take over.
2350 2350
 	 */
2351
-	public function isinstanceof($class,$instance=null);
2351
+	public function isinstanceof($class, $instance=null);
2352 2352
 }
2353 2353
 
2354 2354
 /**
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 
2379 2379
 	public function __construct($s)
2380 2380
 	{
2381
-		$this->_s = $s;
2381
+		$this->_s=$s;
2382 2382
 	}
2383 2383
 
2384 2384
 	public function __toString()
2385 2385
 	{
2386
-		return (string)$this->_s;
2386
+		return (string) $this->_s;
2387 2387
 	}
2388 2388
 
2389 2389
 	public function toJavaScriptLiteral()
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
 {
2404 2404
 	public function toJavaScriptLiteral()
2405 2405
 	{
2406
-		return TJavaScript::jsonEncode((string)$this->_s,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2406
+		return TJavaScript::jsonEncode((string) $this->_s, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2407 2407
 	}
2408 2408
 }
2409 2409
 
Please login to merge, or discard this patch.