Skip to content
This repository
Browse code

code conventions

  • Loading branch information...
commit e94d307ee152171c9d4ce937a085c1947633e944 1 parent ed22c17
Mark authored February 23, 2012 markstory committed February 25, 2012

Showing 36 changed files with 63 additions and 65 deletions. Show diff stats Hide diff stats

  1. 2  lib/Cake/Cache/Engine/XcacheEngine.php
  2. 2  lib/Cake/Console/Command/Task/DbConfigTask.php
  3. 6  lib/Cake/Console/Command/Task/ExtractTask.php
  4. 4  lib/Cake/Core/App.php
  5. 4  lib/Cake/Event/CakeEventManager.php
  6. 16  lib/Cake/I18n/L10n.php
  7. 6  lib/Cake/Model/Behavior/ContainableBehavior.php
  8. 2  lib/Cake/Model/Behavior/TranslateBehavior.php
  9. 2  lib/Cake/Model/CakeSchema.php
  10. 2  lib/Cake/Model/Datasource/Database/Postgres.php
  11. 2  lib/Cake/Model/Datasource/Database/Sqlserver.php
  12. 6  lib/Cake/Model/Datasource/DboSource.php
  13. 2  lib/Cake/Model/Model.php
  14. 2  lib/Cake/Network/CakeResponse.php
  15. 2  lib/Cake/Network/Http/HttpSocket.php
  16. 2  lib/Cake/Test/Case/Console/Command/ApiShellTest.php
  17. 2  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  18. 6  lib/Cake/Test/Case/Core/AppTest.php
  19. 10  lib/Cake/Test/Case/I18n/I18nTest.php
  20. 4  lib/Cake/Test/Case/Model/models.php
  21. 2  lib/Cake/Test/Case/Routing/DispatcherTest.php
  22. 2  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
  23. 2  lib/Cake/Test/test_app/View/Emails/html/default.ctp
  24. 2  lib/Cake/TestSuite/CakeTestLoader.php
  25. 4  lib/Cake/TestSuite/CakeTestSuiteCommand.php
  26. 2  lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
  27. 2  lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
  28. 2  lib/Cake/Utility/File.php
  29. 2  lib/Cake/Utility/Sanitize.php
  30. 8  lib/Cake/Utility/Set.php
  31. 4  lib/Cake/Utility/String.php
  32. 2  lib/Cake/View/Helper/FormHelper.php
  33. 2  lib/Cake/View/Helper/HtmlHelper.php
  34. 2  lib/Cake/View/Helper/RssHelper.php
  35. 4  lib/Cake/View/MediaView.php
  36. 2  lib/Cake/View/View.php
2  lib/Cake/Cache/Engine/XcacheEngine.php
@@ -165,7 +165,7 @@ protected function _auth($reverse = false) {
165 165
 				}
166 166
 				if (!empty($this->settings[$setting])) {
167 167
 					$_SERVER[$key] = $this->settings[$setting];
168  
-				} else if (!empty($this->settings[$key])) {
  168
+				} elseif (!empty($this->settings[$key])) {
169 169
 					$_SERVER[$key] = $this->settings[$key];
170 170
 				} else {
171 171
 					$_SERVER[$key] = $value;
2  lib/Cake/Console/Command/Task/DbConfigTask.php
@@ -100,7 +100,7 @@ protected function _interactive() {
100 100
 				if (preg_match('/[^a-z0-9_]/i', $name)) {
101 101
 					$name = '';
102 102
 					$this->out(__d('cake_console', 'The name may only contain unaccented latin characters, numbers or underscores'));
103  
-				} else if (preg_match('/^[^a-z_]/i', $name)) {
  103
+				} elseif (preg_match('/^[^a-z_]/i', $name)) {
104 104
 					$name = '';
105 105
 					$this->out(__d('cake_console', 'The name must start with an unaccented latin character or an underscore'));
106 106
 				}
6  lib/Cake/Console/Command/Task/ExtractTask.php
@@ -118,7 +118,7 @@ public function execute() {
118 118
 		}
119 119
 		if (isset($this->params['paths'])) {
120 120
 			$this->_paths = explode(',', $this->params['paths']);
121  
-		} else if (isset($this->params['plugin'])) {
  121
+		} elseif (isset($this->params['plugin'])) {
122 122
 			$plugin = Inflector::camelize($this->params['plugin']);
123 123
 			if (!CakePlugin::loaded($plugin)) {
124 124
 				CakePlugin::load($plugin);
@@ -159,7 +159,7 @@ public function execute() {
159 159
 
160 160
 		if (isset($this->params['output'])) {
161 161
 			$this->_output = $this->params['output'];
162  
-		} else if (isset($this->params['plugin'])) {
  162
+		} elseif (isset($this->params['plugin'])) {
163 163
 			$this->_output = $this->_paths[0] . DS . 'Locale';
164 164
 		} else {
165 165
 			$message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0] . DS . 'Locale');
@@ -594,7 +594,7 @@ protected function _getStrings(&$position, $target) {
594 594
 					$position++;
595 595
 				}
596 596
 				$strings[] = $string;
597  
-			} else if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
  597
+			} elseif ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
598 598
 				$strings[] = $this->_formatString($this->_tokens[$position][1]);
599 599
 			}
600 600
 			$position++;
4  lib/Cake/Core/App.php
@@ -652,7 +652,7 @@ public static function import($type = null, $name = null, $parent = true, $searc
652 652
 	protected static function _loadClass($name, $plugin, $type, $originalType, $parent) {
653 653
 		if ($type == 'Console/Command' && $name == 'Shell') {
654 654
 			$type = 'Console';
655  
-		} else if (isset(self::$types[$originalType]['suffix'])) {
  655
+		} elseif (isset(self::$types[$originalType]['suffix'])) {
656 656
 			$suffix = self::$types[$originalType]['suffix'];
657 657
 			$name .= ($suffix == $name) ? '' : $suffix;
658 658
 		}
@@ -691,7 +691,7 @@ protected static function _loadFile($name, $plugin, $search, $file, $return) {
691 691
 		$mapped = self::_mapped($name, $plugin);
692 692
 		if ($mapped) {
693 693
 			$file = $mapped;
694  
-		} else if (!empty($search)) {
  694
+		} elseif (!empty($search)) {
695 695
 			foreach ($search as $path) {
696 696
 				$found = false;
697 697
 				if (file_exists($path . $file)) {
4  lib/Cake/Event/CakeEventManager.php
@@ -126,7 +126,7 @@ protected function _attachSubscriber(CakeEventListener $subscriber) {
126 126
 			$method = $function;
127 127
 			if (is_array($function) && isset($function['callable'])) {
128 128
 				list($method, $options) = $this->_extractCallable($function, $subscriber);
129  
-			} else if (is_array($function) && is_numeric(key($function))) {
  129
+			} elseif (is_array($function) && is_numeric(key($function))) {
130 130
 				foreach ($function as $f) {
131 131
 					list($method, $options) = $this->_extractCallable($f, $subscriber);
132 132
 					$this->attach($method, $eventKey, $options);
@@ -198,7 +198,7 @@ protected function _detachSubscriber(CakeEventListener $subscriber, $eventKey =
198 198
 		$events = $subscriber->implementedEvents();
199 199
 		if (!empty($eventKey) && empty($events[$eventKey])) {
200 200
 			return;
201  
-		} else if (!empty($eventKey)) {
  201
+		} elseif (!empty($eventKey)) {
202 202
 			$events = array($eventKey => $events[$eventKey]);
203 203
 		}
204 204
 		foreach ($events as $key => $function) {
16  lib/Cake/I18n/L10n.php
@@ -355,9 +355,9 @@ protected function _setLanguage($language = null) {
355 355
 		$langKey = null;
356 356
 		if ($language !== null && isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
357 357
 			$langKey = $this->_l10nMap[$language];
358  
-		} else if ($language !== null && isset($this->_l10nCatalog[$language])) {
  358
+		} elseif ($language !== null && isset($this->_l10nCatalog[$language])) {
359 359
 			$langKey = $language;
360  
-		} else if (defined('DEFAULT_LANGUAGE')) {
  360
+		} elseif (defined('DEFAULT_LANGUAGE')) {
361 361
 			$langKey = $language = DEFAULT_LANGUAGE;
362 362
 		}
363 363
 
@@ -379,7 +379,7 @@ protected function _setLanguage($language = null) {
379 379
 		if ($this->default) {
380 380
 			if (isset($this->_l10nMap[$this->default]) && isset($this->_l10nCatalog[$this->_l10nMap[$this->default]])) {
381 381
 				$this->languagePath[] = $this->_l10nCatalog[$this->_l10nMap[$this->default]]['localeFallback'];
382  
-			} else if (isset($this->_l10nCatalog[$this->default])) {
  382
+			} elseif (isset($this->_l10nCatalog[$this->default])) {
383 383
 				$this->languagePath[] = $this->_l10nCatalog[$this->default]['localeFallback'];
384 384
 			}
385 385
 		}
@@ -405,7 +405,7 @@ protected function _autoLanguage() {
405 405
 			if (isset($this->_l10nCatalog[$langKey])) {
406 406
 				$this->_setLanguage($langKey);
407 407
 				return true;
408  
-			} else if (strpos($langKey, '-') !== false) {
  408
+			} elseif (strpos($langKey, '-') !== false) {
409 409
 				$langKey = substr($langKey, 0, 2);
410 410
 				if (isset($this->_l10nCatalog[$langKey])) {
411 411
 					$this->_setLanguage($langKey);
@@ -432,10 +432,10 @@ public function map($mixed = null) {
432 432
 				}
433 433
 			}
434 434
 			return $result;
435  
-		} else if (is_string($mixed)) {
  435
+		} elseif (is_string($mixed)) {
436 436
 			if (strlen($mixed) === 2 && in_array($mixed, $this->_l10nMap)) {
437 437
 				return array_search($mixed, $this->_l10nMap);
438  
-			} else if (isset($this->_l10nMap[$mixed])) {
  438
+			} elseif (isset($this->_l10nMap[$mixed])) {
439 439
 				return $this->_l10nMap[$mixed];
440 440
 			}
441 441
 			return false;
@@ -459,10 +459,10 @@ public function catalog($language = null) {
459 459
 				}
460 460
 			}
461 461
 			return $result;
462  
-		} else if (is_string($language)) {
  462
+		} elseif (is_string($language)) {
463 463
 			if (isset($this->_l10nCatalog[$language])) {
464 464
 				return $this->_l10nCatalog[$language];
465  
-			} else if (isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
  465
+			} elseif (isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
466 466
 				return $this->_l10nCatalog[$this->_l10nMap[$language]];
467 467
 			}
468 468
 			return false;
6  lib/Cake/Model/Behavior/ContainableBehavior.php
@@ -156,7 +156,7 @@ public function beforeFind($Model, $query) {
156 156
 							}
157 157
 							if (!$reset && empty($instance->__backOriginalAssociation)) {
158 158
 								$instance->__backOriginalAssociation = $backupBindings;
159  
-							} else if ($reset) {
  159
+							} elseif ($reset) {
160 160
 								$instance->__backAssociation[$type] = $backupBindings[$type];
161 161
 							}
162 162
 							$instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]);
@@ -198,7 +198,7 @@ public function beforeFind($Model, $query) {
198 198
 			foreach ($mandatory[$Model->alias] as $field) {
199 199
 				if ($field == '--primaryKey--') {
200 200
 					$field = $Model->primaryKey;
201  
-				} else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
  201
+				} elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
202 202
 					list($modelName, $field) = explode('.', $field);
203 203
 					if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) {
204 204
 						$field = $modelName . '.' . (
@@ -372,7 +372,7 @@ public function fieldDependencies($Model, $map, $fields = array()) {
372 372
 					foreach ($bindings as $dependency) {
373 373
 						if ($type == 'hasAndBelongsToMany') {
374 374
 							$fields[$parent][] = '--primaryKey--';
375  
-						} else if ($type == 'belongsTo') {
  375
+						} elseif ($type == 'belongsTo') {
376 376
 							$fields[$parent][] = $dependency . '.--primaryKey--';
377 377
 						}
378 378
 					}
2  lib/Cake/Model/Behavior/TranslateBehavior.php
@@ -143,7 +143,7 @@ public function beforeFind($model, $query) {
143 143
 		$addFields = array();
144 144
 		if (empty($query['fields'])) {
145 145
 			$addFields = $fields;
146  
-		} else if (is_array($query['fields'])) {
  146
+		} elseif (is_array($query['fields'])) {
147 147
 			foreach ($fields as $key => $value) {
148 148
 				$field = (is_numeric($key)) ? $value : $key;
149 149
 
2  lib/Cake/Model/CakeSchema.php
@@ -575,7 +575,7 @@ protected function _values($values) {
575 575
 			foreach ($values as $key => $val) {
576 576
 				if (is_array($val)) {
577 577
 					$vals[] = "'{$key}' => array('" . implode("', '",  $val) . "')";
578  
-				} else if (!is_numeric($key)) {
  578
+				} elseif (!is_numeric($key)) {
579 579
 					$val = var_export($val, true);
580 580
 					$vals[] = "'{$key}' => {$val}";
581 581
 				}
2  lib/Cake/Model/Datasource/Database/Postgres.php
@@ -206,7 +206,7 @@ public function describe($model) {
206 206
 					if ($c->type == 'character varying') {
207 207
 						$length = null;
208 208
 						$type = 'text';
209  
-					} else if ($c->type == 'uuid') {
  209
+					} elseif ($c->type == 'uuid') {
210 210
 						$length = 36;
211 211
 					} else {
212 212
 						$length = intval($c->oct_length);
2  lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -689,7 +689,7 @@ public function buildIndex($indexes, $table = null) {
689 689
 		foreach ($indexes as $name => $value) {
690 690
 			if ($name == 'PRIMARY') {
691 691
 				$join[] = 'PRIMARY KEY (' . $this->name($value['column']) . ')';
692  
-			} else if (isset($value['unique']) && $value['unique']) {
  692
+			} elseif (isset($value['unique']) && $value['unique']) {
693 693
 				$out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE";
694 694
 
695 695
 				if (is_array($value['column'])) {
6  lib/Cake/Model/Datasource/DboSource.php
@@ -577,9 +577,9 @@ public function query() {
577 577
 		} else {
578 578
 			if (isset($args[1]) && $args[1] === true) {
579 579
 				return $this->fetchAll($args[0], true);
580  
-			} else if (isset($args[1]) && !is_array($args[1]) ) {
  580
+			} elseif (isset($args[1]) && !is_array($args[1]) ) {
581 581
 				return $this->fetchAll($args[0], false);
582  
-			} else if (isset($args[1]) && is_array($args[1])) {
  582
+			} elseif (isset($args[1]) && is_array($args[1])) {
583 583
 				if (isset($args[2])) {
584 584
 					$cache = $args[2];
585 585
 				} else {
@@ -1733,7 +1733,7 @@ public function renderStatement($type, $data) {
1733 1733
 				if (trim($indexes) !== '') {
1734 1734
 					$columns .= ',';
1735 1735
 				}
1736  
-				return "CREATE TABLE {$table} (\n{$columns}{$indexes}){$tableParameters};";
  1736
+				return "CREATE TABLE {$table} (\n{$columns}{$indexes}) {$tableParameters};";
1737 1737
 			case 'alter':
1738 1738
 				return;
1739 1739
 		}
2  lib/Cake/Model/Model.php
@@ -793,7 +793,7 @@ public function __isset($name) {
793 793
 				$className = empty($this->__backAssociation[$type][$name]['className']) ?
794 794
 					$name : $this->__backAssociation[$type][$name]['className'];
795 795
 				break;
796  
-			} else if ($type == 'hasAndBelongsToMany') {
  796
+			} elseif ($type == 'hasAndBelongsToMany') {
797 797
 				foreach ($this->{$type} as $k => $relation) {
798 798
 					if (empty($relation['with'])) {
799 799
 						continue;
2  lib/Cake/Network/CakeResponse.php
@@ -972,7 +972,7 @@ public function etag($tag = null, $weak = false) {
972 972
 	protected function _getUTCDate($time = null) {
973 973
 		if ($time instanceof DateTime) {
974 974
 			$result = clone $time;
975  
-		} else if (is_integer($time)) {
  975
+		} elseif (is_integer($time)) {
976 976
 			$result = new DateTime(date('Y-m-d H:i:s', $time));
977 977
 		} else {
978 978
 			$result = new DateTime($time);
2  lib/Cake/Network/Http/HttpSocket.php
@@ -403,7 +403,7 @@ public function request($request = array()) {
403 403
 			$this->config['request']['cookies'][$Host] = array_merge($this->config['request']['cookies'][$Host], $this->response->cookies);
404 404
 		}
405 405
 
406  
-		if($this->request['redirect'] && $this->response->isRedirect()) {
  406
+		if ($this->request['redirect'] && $this->response->isRedirect()) {
407 407
 			$request['uri'] = $this->response->getHeader('Location');
408 408
 			$request['redirect'] = is_int($this->request['redirect']) ? $this->request['redirect'] - 1 : $this->request['redirect'];
409 409
 			$this->response = $this->request($request);
2  lib/Cake/Test/Case/Console/Command/ApiShellTest.php
@@ -50,7 +50,7 @@ public function setUp() {
50 50
  *
51 51
  * @return void
52 52
  */
53  
-	public function testMethodNameDetection () {
  53
+	public function testMethodNameDetection() {
54 54
 		$this->Shell->expects($this->any())->method('in')->will($this->returnValue('q'));
55 55
 		$this->Shell->expects($this->at(0))->method('out')->with('Controller');
56 56
 
2  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
@@ -482,7 +482,7 @@ public function testRevoke() {
482 482
  * @param bool $treesToo
483 483
  * @return void
484 484
  */
485  
-	protected function __debug ($printTreesToo = false) {
  485
+	protected function __debug($printTreesToo = false) {
486 486
 		$this->Acl->Aro->displayField = 'alias';
487 487
 		$this->Acl->Aco->displayField = 'alias';
488 488
 		$aros = $this->Acl->Aro->find('list', array('order' => 'lft'));
6  lib/Cake/Test/Case/Core/AppTest.php
@@ -599,7 +599,7 @@ public function testImportingHelpersFromAlternatePaths() {
599 599
  *
600 600
  * @return void
601 601
  */
602  
-	public function testFileLoading () {
  602
+	public function testFileLoading() {
603 603
 		$file = App::import('File', 'RealFile', false, array(), CAKE  . 'Config' . DS . 'config.php');
604 604
 		$this->assertTrue($file);
605 605
 
@@ -629,7 +629,7 @@ public function testFileLoadingWithArray() {
629 629
  *
630 630
  * @return void
631 631
  */
632  
-	public function testFileLoadingReturnValue () {
  632
+	public function testFileLoadingReturnValue() {
633 633
 		$file = App::import('File', 'Name', false, array(), CAKE  . 'Config' . DS . 'config.php', true);
634 634
 		$this->assertTrue(!empty($file));
635 635
 
@@ -648,7 +648,7 @@ public function testFileLoadingReturnValue () {
648 648
  *
649 649
  * @return void
650 650
  */
651  
-	public function testLoadingWithSearch () {
  651
+	public function testLoadingWithSearch() {
652 652
 		$file = App::import('File', 'NewName', false, array(CAKE . 'Config' . DS), 'config.php');
653 653
 		$this->assertTrue($file);
654 654
 
10  lib/Cake/Test/Case/I18n/I18nTest.php
@@ -2314,7 +2314,7 @@ public function testMoRulesFourteen() {
2314 2314
  *
2315 2315
  * @return void
2316 2316
  */
2317  
-	public function testSetLanguageWithSession () {
  2317
+	public function testSetLanguageWithSession() {
2318 2318
 		$_SESSION['Config']['language'] = 'po';
2319 2319
 		$singular = $this->__singular();
2320 2320
 		$this->assertEquals('Po (translated)', $singular);
@@ -2354,7 +2354,7 @@ public function testSetLanguageWithSession () {
2354 2354
  *
2355 2355
  * @return void
2356 2356
  */
2357  
-	public function testNoCoreTranslation () {
  2357
+	public function testNoCoreTranslation() {
2358 2358
 		Configure::write('Config.language', 'po');
2359 2359
 		$singular = $this->__singular();
2360 2360
 		$this->assertEquals('Po (translated)', $singular);
@@ -2439,7 +2439,7 @@ public function testPluginTranslation() {
2439 2439
  *
2440 2440
  * @return void
2441 2441
  */
2442  
-	public function testPoMultipleLineTranslation () {
  2442
+	public function testPoMultipleLineTranslation() {
2443 2443
 		Configure::write('Config.language', 'po');
2444 2444
 
2445 2445
 		$string = "This is a multiline translation\n";
@@ -2512,7 +2512,7 @@ public function testPoMultipleLineTranslation () {
2512 2512
  *
2513 2513
  * @return void
2514 2514
  */
2515  
-	public function testPoNoTranslationNeeded () {
  2515
+	public function testPoNoTranslationNeeded() {
2516 2516
 		Configure::write('Config.language', 'po');
2517 2517
 		$result = __('No Translation needed');
2518 2518
 		$this->assertEquals('No Translation needed', $result);
@@ -2523,7 +2523,7 @@ public function testPoNoTranslationNeeded () {
2523 2523
  *
2524 2524
  * @return void
2525 2525
  */
2526  
-	public function testPoQuotedString () {
  2526
+	public function testPoQuotedString() {
2527 2527
 		Configure::write('Config.language', 'po');
2528 2528
 		$expected = 'this is a "quoted string" (translated)';
2529 2529
 		$this->assertEquals($expected, __('this is a "quoted string"'));
4  lib/Cake/Test/Case/Model/models.php
@@ -183,7 +183,7 @@ class User extends CakeTestModel {
183 183
  *
184 184
  * @return bool
185 185
 */
186  
-	public function beforeFind ($queryData) {
  186
+	public function beforeFind($queryData) {
187 187
 		if (!empty($queryData['lazyLoad'])) {
188 188
 			if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
189 189
 				throw new Exception('Unavailable associations');
@@ -257,7 +257,7 @@ public function beforeSave($options = array()) {
257 257
  * @param mixed $title
258 258
  * @return void
259 259
  */
260  
-	static function titleDuplicate ($title) {
  260
+	static function titleDuplicate($title) {
261 261
 		if ($title === 'My Article Title') {
262 262
 			return false;
263 263
 		}
2  lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -20,7 +20,7 @@
20 20
 
21 21
 if (!class_exists('AppController', false)) {
22 22
 	require_once CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS . 'AppController.php';
23  
-} elseif (!defined('APP_CONTROLLER_EXISTS')){
  23
+} elseif (!defined('APP_CONTROLLER_EXISTS')) {
24 24
 	define('APP_CONTROLLER_EXISTS', true);
25 25
 }
26 26
 
2  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -228,7 +228,7 @@ public function testMultipleNoCacheTagsInViewfile() {
228 228
  *
229 229
  * @return void
230 230
  */
231  
-	public function testComplexNoCache () {
  231
+	public function testComplexNoCache() {
232 232
 		$this->Controller->cache_parsing();
233 233
 		$this->Controller->request->addParams(array(
234 234
 			'controller' => 'cache_test',
2  lib/Cake/Test/test_app/View/Emails/html/default.ctp
@@ -19,7 +19,7 @@
19 19
 <?php
20 20
 $content = explode("\n", $content);
21 21
 
22  
-foreach($content as $line):
  22
+foreach ($content as $line):
23 23
 	echo '<p> ' . $line . '</p>';
24 24
 endforeach;
25 25
 ?>
2  lib/Cake/TestSuite/CakeTestLoader.php
@@ -61,7 +61,7 @@ protected static function _basePath($params) {
61 61
 		$result = null;
62 62
 		if (!empty($params['core'])) {
63 63
 			$result = CORE_TEST_CASES;
64  
-		} else if (!empty($params['plugin'])) {
  64
+		} elseif (!empty($params['plugin'])) {
65 65
 			if (!CakePlugin::loaded($params['plugin'])) {
66 66
 				try {
67 67
 					CakePlugin::load($params['plugin']);
4  lib/Cake/TestSuite/CakeTestSuiteCommand.php
@@ -115,9 +115,7 @@ public function run(array $argv, $exit = true) {
115 115
 		if ($exit) {
116 116
 			if (isset($result) && $result->wasSuccessful()) {
117 117
 				exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
118  
-			}
119  
-
120  
-			else if (!isset($result) || $result->errorCount() > 0) {
  118
+			} elseif (!isset($result) || $result->errorCount() > 0) {
121 119
 				exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
122 120
 			}
123 121
 
2  lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
@@ -152,7 +152,7 @@ protected function _calculateCoveredLines($fileLines, $coverageData) {
152 152
 			if (is_array($coverageData[$lineno]) && !empty($coverageData[$lineno])) {
153 153
 				$covered++;
154 154
 				$total++;
155  
-			} else if ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
  155
+			} elseif ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
156 156
 				$total++;
157 157
 			}
158 158
 		}
2  lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
@@ -154,7 +154,7 @@ function coverage_show_hide(selector) {
154 154
 			var element = document.getElementById(selector);
155 155
 			element.style.display = (element.style.display == 'none') ? '' : 'none';
156 156
 		}
157  
-		function coverage_toggle_all () {
  157
+		function coverage_toggle_all() {
158 158
 			var divs = document.querySelectorAll('div.coverage-container');
159 159
 			var i = divs.length;
160 160
 			while (i--) {
2  lib/Cake/Utility/File.php
@@ -561,7 +561,7 @@ public function mime() {
561 561
 			$finfo = finfo_open(FILEINFO_MIME);
562 562
 			list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd()));
563 563
 			return $type;
564  
-		} else if (function_exists('mime_content_type')) {
  564
+		} elseif (function_exists('mime_content_type')) {
565 565
 			return mime_content_type($this->pwd());
566 566
 		}
567 567
 		return false;
2  lib/Cake/Utility/Sanitize.php
@@ -214,7 +214,7 @@ public static function clean($data, $options = array()) {
214 214
 
215 215
 		if (is_string($options)) {
216 216
 			$options = array('connection' => $options);
217  
-		} else if (!is_array($options)) {
  217
+		} elseif (!is_array($options)) {
218 218
 			$options = array();
219 219
 		}
220 220
 
8  lib/Cake/Utility/Set.php
@@ -477,7 +477,7 @@ public static function extract($path, $data = null, $options = array()) {
477 477
 			if (empty($tokens)) {
478 478
 				break;
479 479
 			}
480  
-		} while(1);
  480
+		} while (1);
481 481
 
482 482
 		$r = array();
483 483
 
@@ -760,7 +760,7 @@ public static function check($data, $path = null) {
760 760
  * @param mixed $val1 First value
761 761
  * @param mixed $val2 Second value
762 762
  * @return array Returns the key => value pairs that are not common in $val1 and $val2
763  
- * The expression for this function is ($val1 - $val2) + ($val2 - ($val1 - $val2))
  763
+ * The expression for this function is($val1 - $val2) + ($val2 - ($val1 - $val2))
764 764
  * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::diff
765 765
  */
766 766
 	public static function diff($val1, $val2 = null) {
@@ -963,7 +963,7 @@ public static function reverse($object) {
963 963
 		$out = array();
964 964
 		if ($object instanceof SimpleXMLElement) {
965 965
 			return Xml::toArray($object);
966  
-		} else if (is_object($object)) {
  966
+		} elseif (is_object($object)) {
967 967
 			$keys = get_object_vars($object);
968 968
 			if (isset($keys['_name_'])) {
969 969
 				$identity = $keys['_name_'];
@@ -1205,7 +1205,7 @@ public static function get($input, $path = null) {
1205 1205
 		}
1206 1206
 
1207 1207
 		$return = $input;
1208  
-		foreach($keys as $key) {
  1208
+		foreach ($keys as $key) {
1209 1209
 			if (!isset($return[$key])) {
1210 1210
 				return null;
1211 1211
 			}
4  lib/Cake/Utility/String.php
@@ -81,7 +81,7 @@ public static function uuid() {
81 81
 
82 82
 		if (function_exists('hphp_get_thread_id')) {
83 83
 			$pid = hphp_get_thread_id();
84  
-		} else if (function_exists('zend_thread_id')) {
  84
+		} elseif (function_exists('zend_thread_id')) {
85 85
 			$pid = zend_thread_id();
86 86
 		} else {
87 87
 			$pid = getmypid();
@@ -458,7 +458,7 @@ class_exists('Multibyte');
458 458
 				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) {
459 459
 					if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) {
460 460
 						array_unshift($openTags, $tag[2]);
461  
-					} else if (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) {
  461
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) {
462 462
 						$pos = array_search($closeTag[1], $openTags);
463 463
 						if ($pos !== false) {
464 464
 							array_splice($openTags, $pos, 1);
2  lib/Cake/View/Helper/FormHelper.php
@@ -2523,7 +2523,7 @@ protected function _generateOptions($name, $options = array()) {
2523 2523
 					$data['10'] = __d('cake', 'October');
2524 2524
 					$data['11'] = __d('cake', 'November');
2525 2525
 					$data['12'] = __d('cake', 'December');
2526  
-				} else if (is_array($options['monthNames'])) {
  2526
+				} elseif (is_array($options['monthNames'])) {
2527 2527
 					$data = $options['monthNames'];
2528 2528
 				} else {
2529 2529
 					for ($m = 1; $m <= 12; $m++) {
2  lib/Cake/View/Helper/HtmlHelper.php
@@ -1136,7 +1136,7 @@ protected function _nestedListItem($items, $options, $itemOptions, $tag) {
1136 1136
 			}
1137 1137
 			if (isset($itemOptions['even']) && $index % 2 == 0) {
1138 1138
 				$itemOptions['class'] = $itemOptions['even'];
1139  
-			} else if (isset($itemOptions['odd']) && $index % 2 != 0) {
  1139
+			} elseif (isset($itemOptions['odd']) && $index % 2 != 0) {
1140 1140
 				$itemOptions['class'] = $itemOptions['odd'];
1141 1141
 			}
1142 1142
 			$out .= sprintf($this->_tags['li'], $this->_parseAttributes($itemOptions, array('even', 'odd'), ' ', ''), $item);
2  lib/Cake/View/Helper/RssHelper.php
@@ -220,7 +220,7 @@ public function item($att = array(), $elements = array()) {
220 220
 						}
221 221
 						$elements[$key] = implode('', $categories);
222 222
 						continue 2;
223  
-					} else if (is_array($val) && isset($val['domain'])) {
  223
+					} elseif (is_array($val) && isset($val['domain'])) {
224 224
 						$attrib['domain'] = $val['domain'];
225 225
 					}
226 226
 				break;
4  lib/Cake/View/MediaView.php
@@ -41,7 +41,7 @@
41 41
  *
42 42
  * {{{
43 43
  * class ExampleController extends AppController {
44  
- *		public function download () {
  44
+ *		public function download() {
45 45
  *			$this->viewClass = 'Media';
46 46
  *			$params = array(
47 47
  *				'id' => 'example.zip',
@@ -142,7 +142,7 @@ public function render($view = null, $layout = null) {
142 142
 
143 143
 				if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) {
144 144
 					$contentType = 'application/octetstream';
145  
-				} else if (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
  145
+				} elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
146 146
 					$contentType = 'application/force-download';
147 147
 				}
148 148
 
2  lib/Cake/View/View.php
@@ -952,7 +952,7 @@ protected function _getViewFileName($name = null) {
952 952
 					return $name;
953 953
 				}
954 954
 				$name = trim($name, DS);
955  
-			} else if ($name[0] === '.') {
  955
+			} elseif ($name[0] === '.') {
956 956
 				$name = substr($name, 3);
957 957
 			} elseif (!$plugin) {
958 958
 				$name = $this->viewPath . DS . $subDir . $name;

0 notes on commit e94d307

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