Skip to content
This repository
Browse code

correcting coding-standards

  • Loading branch information...
commit b7f1740d2bc1aaff2ee6a014a0600238a396b877 1 parent 76d21c6
Mark authored September 28, 2012
2  lib/Cake/Console/Command/Task/ControllerTask.php
@@ -432,7 +432,7 @@ public function getName($useDbConfig = null) {
432 432
 			}
433 433
 		}
434 434
 
435  
-		if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers) ) {
  435
+		if (intval($enteredController) > 0 && intval($enteredController) <= count($controllers)) {
436 436
 			$controllerName = $controllers[intval($enteredController) - 1];
437 437
 		} else {
438 438
 			$controllerName = Inflector::camelize($enteredController);
10  lib/Cake/Console/Command/Task/ModelTask.php
@@ -688,7 +688,7 @@ public function doMoreAssociations(Model $model, $associations) {
688 688
 		$prompt = __d('cake_console', 'Would you like to define some additional model associations?');
689 689
 		$wannaDoMoreAssoc = $this->in($prompt, array('y', 'n'), 'n');
690 690
 		$possibleKeys = $this->_generatePossibleKeys();
691  
-		while (strtolower($wannaDoMoreAssoc) == 'y') {
  691
+		while (strtolower($wannaDoMoreAssoc) === 'y') {
692 692
 			$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
693 693
 			$this->out(__d('cake_console', 'What is the association type?'));
694 694
 			$assocType = intval($this->inOptions($assocs, __d('cake_console', 'Enter a number')));
@@ -698,9 +698,9 @@ public function doMoreAssociations(Model $model, $associations) {
698 698
 			$this->hr();
699 699
 
700 700
 			$alias = $this->in(__d('cake_console', 'What is the alias for this association?'));
701  
-			$className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias );
  701
+			$className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias);
702 702
 
703  
-			if ($assocType == 0) {
  703
+			if ($assocType === 0) {
704 704
 				if (!empty($possibleKeys[$model->table])) {
705 705
 					$showKeys = $possibleKeys[$model->table];
706 706
 				} else {
@@ -733,7 +733,7 @@ public function doMoreAssociations(Model $model, $associations) {
733 733
 			if (!isset($foreignKey)) {
734 734
 				$foreignKey = $this->in(__d('cake_console', 'What is the foreignKey? Specify your own.'), null, $suggestedForeignKey);
735 735
 			}
736  
-			if ($assocType == 3) {
  736
+			if ($assocType === 3) {
737 737
 				$associationForeignKey = $this->in(__d('cake_console', 'What is the associationForeignKey?'), null, $this->_modelKey($model->name));
738 738
 				$joinTable = $this->in(__d('cake_console', 'What is the joinTable?'));
739 739
 			}
@@ -743,7 +743,7 @@ public function doMoreAssociations(Model $model, $associations) {
743 743
 			$associations[$assocs[$assocType]][$i]['alias'] = $alias;
744 744
 			$associations[$assocs[$assocType]][$i]['className'] = $className;
745 745
 			$associations[$assocs[$assocType]][$i]['foreignKey'] = $foreignKey;
746  
-			if ($assocType == 3) {
  746
+			if ($assocType === 3) {
747 747
 				$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
748 748
 				$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
749 749
 			}
4  lib/Cake/Model/Model.php
@@ -1881,7 +1881,7 @@ protected function _saveMulti($joined, $id, $db) {
1881 1881
 					if ($keepExisting && !empty($links)) {
1882 1882
 						foreach ($links as $link) {
1883 1883
 							$oldJoin = $link[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']];
1884  
-							if (! in_array($oldJoin, $newJoins) ) {
  1884
+							if (!in_array($oldJoin, $newJoins)) {
1885 1885
 								$conditions[$associationForeignKey] = $oldJoin;
1886 1886
 								$db->delete($this->{$join}, $conditions);
1887 1887
 							} else {
@@ -2735,7 +2735,7 @@ protected function _findFirst($state, $query, $results = array()) {
2735 2735
  */
2736 2736
 	protected function _findCount($state, $query, $results = array()) {
2737 2737
 		if ($state === 'before') {
2738  
-			if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count' ) {
  2738
+			if (!empty($query['type']) && isset($this->findMethods[$query['type']]) && $query['type'] !== 'count') {
2739 2739
 				$query['operation'] = 'count';
2740 2740
 				$query = $this->{'_find' . ucfirst($query['type'])}('before', $query);
2741 2741
 			}
2  lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -694,7 +694,7 @@ public function testTestCaseFileName($type, $class, $expected) {
694 694
 	public function testTestCaseFileNamePlugin() {
695 695
 		$this->Task->path = DS . 'my' . DS . 'path' . DS . 'tests' . DS;
696 696
 
697  
-		CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS ));
  697
+		CakePlugin::load('TestTest', array('path' => APP . 'Plugin' . DS . 'TestTest' . DS));
698 698
 		$this->Task->plugin = 'TestTest';
699 699
 		$result = $this->Task->testCaseFileName('Model', 'Post');
700 700
 		$expected = APP . 'Plugin' . DS . 'TestTest' . DS . 'Test' . DS . 'Case' . DS . 'Model' . DS . 'PostTest.php';
2  lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
@@ -118,7 +118,7 @@ public function testAroAliases() {
118 118
 		$this->Acl->Aro->addAlias(array('Role/25' => 'Role/IT'));
119 119
 		$this->Acl->allow('Role/IT', '/rules/debugging/*');
120 120
 
121  
-		$this->assertEquals(array(array('Role/IT', )), $this->Acl->Aro->roles($user));
  121
+		$this->assertEquals(array(array('Role/IT')), $this->Acl->Aro->roles($user));
122 122
 		$this->assertTrue($this->Acl->check($user, '/rules/debugging/stats/pageload'));
123 123
 		$this->assertTrue($this->Acl->check($user, '/rules/debugging/sql/queries'));
124 124
 		// Role/default is allowed users dashboard, but not Role/IT
4  lib/Cake/Test/Case/I18n/I18nTest.php
@@ -1893,7 +1893,7 @@ private function __domainSingular($domain = 'test_plugin') {
1893 1893
 	private function __domainPlural($domain = 'test_plugin') {
1894 1894
 		$plurals = array();
1895 1895
 		for ($number = 0; $number <= 25; $number++) {
1896  
-			$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number );
  1896
+			$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
1897 1897
 		}
1898 1898
 		return $plurals;
1899 1899
 	}
@@ -1949,7 +1949,7 @@ private function __singularFromCore() {
1949 1949
 	private function __pluralFromCore() {
1950 1950
 		$plurals = array();
1951 1951
 		for ($number = 0; $number <= 25; $number++) {
1952  
-			$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number );
  1952
+			$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number);
1953 1953
 		}
1954 1954
 		return $plurals;
1955 1955
 	}
116  lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
@@ -636,8 +636,8 @@ public function testMoveUpSuccess() {
636 636
 		$parent = $this->Tree->findByName('1. Root', array('id'));
637 637
 		$this->Tree->id = $parent[$modelClass]['id'];
638 638
 		$result = $this->Tree->children(null, true, array('name'));
639  
-		$expected = array(array($modelClass => array('name' => '1.2', )),
640  
-			array($modelClass => array('name' => '1.1', )));
  639
+		$expected = array(array($modelClass => array('name' => '1.2')),
  640
+			array($modelClass => array('name' => '1.1')));
641 641
 		$this->assertSame($expected, $result);
642 642
 	}
643 643
 
@@ -658,8 +658,8 @@ public function testMoveUpFail() {
658 658
 		$parent = $this->Tree->findByName('1. Root', array('id'));
659 659
 		$this->Tree->id = $parent[$modelClass]['id'];
660 660
 		$result = $this->Tree->children(null, true, array('name'));
661  
-		$expected = array(array($modelClass => array('name' => '1.1', )),
662  
-			array($modelClass => array('name' => '1.2', )));
  661
+		$expected = array(array($modelClass => array('name' => '1.1')),
  662
+			array($modelClass => array('name' => '1.2')));
663 663
 		$this->assertSame($expected, $result);
664 664
 	}
665 665
 
@@ -680,16 +680,16 @@ public function testMoveUp2() {
680 680
 		$this->Tree->id = $parent[$modelClass]['id'];
681 681
 		$result = $this->Tree->children(null, true, array('name'));
682 682
 		$expected = array(
683  
-			array($modelClass => array('name' => '1.1', )),
684  
-			array($modelClass => array('name' => '1.2', )),
685  
-			array($modelClass => array('name' => '1.5', )),
686  
-			array($modelClass => array('name' => '1.3', )),
687  
-			array($modelClass => array('name' => '1.4', )),
688  
-			array($modelClass => array('name' => '1.6', )),
689  
-			array($modelClass => array('name' => '1.7', )),
690  
-			array($modelClass => array('name' => '1.8', )),
691  
-			array($modelClass => array('name' => '1.9', )),
692  
-			array($modelClass => array('name' => '1.10', )));
  683
+			array($modelClass => array('name' => '1.1')),
  684
+			array($modelClass => array('name' => '1.2')),
  685
+			array($modelClass => array('name' => '1.5')),
  686
+			array($modelClass => array('name' => '1.3')),
  687
+			array($modelClass => array('name' => '1.4')),
  688
+			array($modelClass => array('name' => '1.6')),
  689
+			array($modelClass => array('name' => '1.7')),
  690
+			array($modelClass => array('name' => '1.8')),
  691
+			array($modelClass => array('name' => '1.9')),
  692
+			array($modelClass => array('name' => '1.10')));
693 693
 		$this->assertSame($expected, $result);
694 694
 	}
695 695
 
@@ -710,16 +710,16 @@ public function testMoveUpFirst() {
710 710
 		$this->Tree->id = $parent[$modelClass]['id'];
711 711
 		$result = $this->Tree->children(null, true, array('name'));
712 712
 		$expected = array(
713  
-			array($modelClass => array('name' => '1.5', )),
714  
-			array($modelClass => array('name' => '1.1', )),
715  
-			array($modelClass => array('name' => '1.2', )),
716  
-			array($modelClass => array('name' => '1.3', )),
717  
-			array($modelClass => array('name' => '1.4', )),
718  
-			array($modelClass => array('name' => '1.6', )),
719  
-			array($modelClass => array('name' => '1.7', )),
720  
-			array($modelClass => array('name' => '1.8', )),
721  
-			array($modelClass => array('name' => '1.9', )),
722  
-			array($modelClass => array('name' => '1.10', )));
  713
+			array($modelClass => array('name' => '1.5')),
  714
+			array($modelClass => array('name' => '1.1')),
  715
+			array($modelClass => array('name' => '1.2')),
  716
+			array($modelClass => array('name' => '1.3')),
  717
+			array($modelClass => array('name' => '1.4')),
  718
+			array($modelClass => array('name' => '1.6')),
  719
+			array($modelClass => array('name' => '1.7')),
  720
+			array($modelClass => array('name' => '1.8')),
  721
+			array($modelClass => array('name' => '1.9')),
  722
+			array($modelClass => array('name' => '1.10')));
723 723
 		$this->assertSame($expected, $result);
724 724
 	}
725 725
 
@@ -739,8 +739,8 @@ public function testMoveDownSuccess() {
739 739
 		$parent = $this->Tree->findByName('1. Root', array('id'));
740 740
 		$this->Tree->id = $parent[$modelClass]['id'];
741 741
 		$result = $this->Tree->children(null, true, array('name'));
742  
-		$expected = array(array($modelClass => array('name' => '1.2', )),
743  
-			array($modelClass => array('name' => '1.1', )));
  742
+		$expected = array(array($modelClass => array('name' => '1.2')),
  743
+			array($modelClass => array('name' => '1.1')));
744 744
 		$this->assertSame($expected, $result);
745 745
 	}
746 746
 
@@ -760,8 +760,8 @@ public function testMoveDownFail() {
760 760
 		$parent = $this->Tree->findByName('1. Root', array('id'));
761 761
 		$this->Tree->id = $parent[$modelClass]['id'];
762 762
 		$result = $this->Tree->children(null, true, array('name'));
763  
-		$expected = array(array($modelClass => array('name' => '1.1', )),
764  
-			array($modelClass => array('name' => '1.2', )));
  763
+		$expected = array(array($modelClass => array('name' => '1.1')),
  764
+			array($modelClass => array('name' => '1.2')));
765 765
 		$this->assertSame($expected, $result);
766 766
 	}
767 767
 
@@ -782,16 +782,16 @@ public function testMoveDownLast() {
782 782
 		$this->Tree->id = $parent[$modelClass]['id'];
783 783
 		$result = $this->Tree->children(null, true, array('name'));
784 784
 		$expected = array(
785  
-			array($modelClass => array('name' => '1.1', )),
786  
-			array($modelClass => array('name' => '1.2', )),
787  
-			array($modelClass => array('name' => '1.3', )),
788  
-			array($modelClass => array('name' => '1.4', )),
789  
-			array($modelClass => array('name' => '1.6', )),
790  
-			array($modelClass => array('name' => '1.7', )),
791  
-			array($modelClass => array('name' => '1.8', )),
792  
-			array($modelClass => array('name' => '1.9', )),
793  
-			array($modelClass => array('name' => '1.10', )),
794  
-			array($modelClass => array('name' => '1.5', )));
  785
+			array($modelClass => array('name' => '1.1')),
  786
+			array($modelClass => array('name' => '1.2')),
  787
+			array($modelClass => array('name' => '1.3')),
  788
+			array($modelClass => array('name' => '1.4')),
  789
+			array($modelClass => array('name' => '1.6')),
  790
+			array($modelClass => array('name' => '1.7')),
  791
+			array($modelClass => array('name' => '1.8')),
  792
+			array($modelClass => array('name' => '1.9')),
  793
+			array($modelClass => array('name' => '1.10')),
  794
+			array($modelClass => array('name' => '1.5')));
795 795
 		$this->assertSame($expected, $result);
796 796
 	}
797 797
 
@@ -812,16 +812,16 @@ public function testMoveDown2() {
812 812
 		$this->Tree->id = $parent[$modelClass]['id'];
813 813
 		$result = $this->Tree->children(null, true, array('name'));
814 814
 		$expected = array(
815  
-			array($modelClass => array('name' => '1.1', )),
816  
-			array($modelClass => array('name' => '1.2', )),
817  
-			array($modelClass => array('name' => '1.3', )),
818  
-			array($modelClass => array('name' => '1.4', )),
819  
-			array($modelClass => array('name' => '1.6', )),
820  
-			array($modelClass => array('name' => '1.7', )),
821  
-			array($modelClass => array('name' => '1.5', )),
822  
-			array($modelClass => array('name' => '1.8', )),
823  
-			array($modelClass => array('name' => '1.9', )),
824  
-			array($modelClass => array('name' => '1.10', )));
  815
+			array($modelClass => array('name' => '1.1')),
  816
+			array($modelClass => array('name' => '1.2')),
  817
+			array($modelClass => array('name' => '1.3')),
  818
+			array($modelClass => array('name' => '1.4')),
  819
+			array($modelClass => array('name' => '1.6')),
  820
+			array($modelClass => array('name' => '1.7')),
  821
+			array($modelClass => array('name' => '1.5')),
  822
+			array($modelClass => array('name' => '1.8')),
  823
+			array($modelClass => array('name' => '1.9')),
  824
+			array($modelClass => array('name' => '1.10')));
825 825
 		$this->assertSame($expected, $result);
826 826
 	}
827 827
 
@@ -842,16 +842,16 @@ public function testSaveNoMove() {
842 842
 		$this->Tree->id = $parent[$modelClass]['id'];
843 843
 		$result = $this->Tree->children(null, true, array('name'));
844 844
 		$expected = array(
845  
-			array($modelClass => array('name' => '1.1', )),
846  
-			array($modelClass => array('name' => '1.2', )),
847  
-			array($modelClass => array('name' => '1.3', )),
848  
-			array($modelClass => array('name' => '1.4', )),
849  
-			array($modelClass => array('name' => 'renamed', )),
850  
-			array($modelClass => array('name' => '1.6', )),
851  
-			array($modelClass => array('name' => '1.7', )),
852  
-			array($modelClass => array('name' => '1.8', )),
853  
-			array($modelClass => array('name' => '1.9', )),
854  
-			array($modelClass => array('name' => '1.10', )));
  845
+			array($modelClass => array('name' => '1.1')),
  846
+			array($modelClass => array('name' => '1.2')),
  847
+			array($modelClass => array('name' => '1.3')),
  848
+			array($modelClass => array('name' => '1.4')),
  849
+			array($modelClass => array('name' => 'renamed')),
  850
+			array($modelClass => array('name' => '1.6')),
  851
+			array($modelClass => array('name' => '1.7')),
  852
+			array($modelClass => array('name' => '1.8')),
  853
+			array($modelClass => array('name' => '1.9')),
  854
+			array($modelClass => array('name' => '1.10')));
855 855
 		$this->assertSame($expected, $result);
856 856
 	}
857 857
 

0 notes on commit b7f1740

Please sign in to comment.
Something went wrong with that request. Please try again.