Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

code conventions

  • Loading branch information...
commit e94d307ee152171c9d4ce937a085c1947633e944 1 parent ed22c17
@dereuromark dereuromark authored markstory committed
Showing with 63 additions and 65 deletions.
  1. +1 −1  lib/Cake/Cache/Engine/XcacheEngine.php
  2. +1 −1  lib/Cake/Console/Command/Task/DbConfigTask.php
  3. +3 −3 lib/Cake/Console/Command/Task/ExtractTask.php
  4. +2 −2 lib/Cake/Core/App.php
  5. +2 −2 lib/Cake/Event/CakeEventManager.php
  6. +8 −8 lib/Cake/I18n/L10n.php
  7. +3 −3 lib/Cake/Model/Behavior/ContainableBehavior.php
  8. +1 −1  lib/Cake/Model/Behavior/TranslateBehavior.php
  9. +1 −1  lib/Cake/Model/CakeSchema.php
  10. +1 −1  lib/Cake/Model/Datasource/Database/Postgres.php
  11. +1 −1  lib/Cake/Model/Datasource/Database/Sqlserver.php
  12. +3 −3 lib/Cake/Model/Datasource/DboSource.php
  13. +1 −1  lib/Cake/Model/Model.php
  14. +1 −1  lib/Cake/Network/CakeResponse.php
  15. +1 −1  lib/Cake/Network/Http/HttpSocket.php
  16. +1 −1  lib/Cake/Test/Case/Console/Command/ApiShellTest.php
  17. +1 −1  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
  18. +3 −3 lib/Cake/Test/Case/Core/AppTest.php
  19. +5 −5 lib/Cake/Test/Case/I18n/I18nTest.php
  20. +2 −2 lib/Cake/Test/Case/Model/models.php
  21. +1 −1  lib/Cake/Test/Case/Routing/DispatcherTest.php
  22. +1 −1  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
  23. +1 −1  lib/Cake/Test/test_app/View/Emails/html/default.ctp
  24. +1 −1  lib/Cake/TestSuite/CakeTestLoader.php
  25. +1 −3 lib/Cake/TestSuite/CakeTestSuiteCommand.php
  26. +1 −1  lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
  27. +1 −1  lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
  28. +1 −1  lib/Cake/Utility/File.php
  29. +1 −1  lib/Cake/Utility/Sanitize.php
  30. +4 −4 lib/Cake/Utility/Set.php
  31. +2 −2 lib/Cake/Utility/String.php
  32. +1 −1  lib/Cake/View/Helper/FormHelper.php
  33. +1 −1  lib/Cake/View/Helper/HtmlHelper.php
  34. +1 −1  lib/Cake/View/Helper/RssHelper.php
  35. +2 −2 lib/Cake/View/MediaView.php
  36. +1 −1  lib/Cake/View/View.php
View
2  lib/Cake/Cache/Engine/XcacheEngine.php
@@ -165,7 +165,7 @@ protected function _auth($reverse = false) {
}
if (!empty($this->settings[$setting])) {
$_SERVER[$key] = $this->settings[$setting];
- } else if (!empty($this->settings[$key])) {
+ } elseif (!empty($this->settings[$key])) {
$_SERVER[$key] = $this->settings[$key];
} else {
$_SERVER[$key] = $value;
View
2  lib/Cake/Console/Command/Task/DbConfigTask.php
@@ -100,7 +100,7 @@ protected function _interactive() {
if (preg_match('/[^a-z0-9_]/i', $name)) {
$name = '';
$this->out(__d('cake_console', 'The name may only contain unaccented latin characters, numbers or underscores'));
- } else if (preg_match('/^[^a-z_]/i', $name)) {
+ } elseif (preg_match('/^[^a-z_]/i', $name)) {
$name = '';
$this->out(__d('cake_console', 'The name must start with an unaccented latin character or an underscore'));
}
View
6 lib/Cake/Console/Command/Task/ExtractTask.php
@@ -118,7 +118,7 @@ public function execute() {
}
if (isset($this->params['paths'])) {
$this->_paths = explode(',', $this->params['paths']);
- } else if (isset($this->params['plugin'])) {
+ } elseif (isset($this->params['plugin'])) {
$plugin = Inflector::camelize($this->params['plugin']);
if (!CakePlugin::loaded($plugin)) {
CakePlugin::load($plugin);
@@ -159,7 +159,7 @@ public function execute() {
if (isset($this->params['output'])) {
$this->_output = $this->params['output'];
- } else if (isset($this->params['plugin'])) {
+ } elseif (isset($this->params['plugin'])) {
$this->_output = $this->_paths[0] . DS . 'Locale';
} else {
$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) {
$position++;
}
$strings[] = $string;
- } else if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
+ } elseif ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
$strings[] = $this->_formatString($this->_tokens[$position][1]);
}
$position++;
View
4 lib/Cake/Core/App.php
@@ -652,7 +652,7 @@ public static function import($type = null, $name = null, $parent = true, $searc
protected static function _loadClass($name, $plugin, $type, $originalType, $parent) {
if ($type == 'Console/Command' && $name == 'Shell') {
$type = 'Console';
- } else if (isset(self::$types[$originalType]['suffix'])) {
+ } elseif (isset(self::$types[$originalType]['suffix'])) {
$suffix = self::$types[$originalType]['suffix'];
$name .= ($suffix == $name) ? '' : $suffix;
}
@@ -691,7 +691,7 @@ protected static function _loadFile($name, $plugin, $search, $file, $return) {
$mapped = self::_mapped($name, $plugin);
if ($mapped) {
$file = $mapped;
- } else if (!empty($search)) {
+ } elseif (!empty($search)) {
foreach ($search as $path) {
$found = false;
if (file_exists($path . $file)) {
View
4 lib/Cake/Event/CakeEventManager.php
@@ -126,7 +126,7 @@ protected function _attachSubscriber(CakeEventListener $subscriber) {
$method = $function;
if (is_array($function) && isset($function['callable'])) {
list($method, $options) = $this->_extractCallable($function, $subscriber);
- } else if (is_array($function) && is_numeric(key($function))) {
+ } elseif (is_array($function) && is_numeric(key($function))) {
foreach ($function as $f) {
list($method, $options) = $this->_extractCallable($f, $subscriber);
$this->attach($method, $eventKey, $options);
@@ -198,7 +198,7 @@ protected function _detachSubscriber(CakeEventListener $subscriber, $eventKey =
$events = $subscriber->implementedEvents();
if (!empty($eventKey) && empty($events[$eventKey])) {
return;
- } else if (!empty($eventKey)) {
+ } elseif (!empty($eventKey)) {
$events = array($eventKey => $events[$eventKey]);
}
foreach ($events as $key => $function) {
View
16 lib/Cake/I18n/L10n.php
@@ -355,9 +355,9 @@ protected function _setLanguage($language = null) {
$langKey = null;
if ($language !== null && isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
$langKey = $this->_l10nMap[$language];
- } else if ($language !== null && isset($this->_l10nCatalog[$language])) {
+ } elseif ($language !== null && isset($this->_l10nCatalog[$language])) {
$langKey = $language;
- } else if (defined('DEFAULT_LANGUAGE')) {
+ } elseif (defined('DEFAULT_LANGUAGE')) {
$langKey = $language = DEFAULT_LANGUAGE;
}
@@ -379,7 +379,7 @@ protected function _setLanguage($language = null) {
if ($this->default) {
if (isset($this->_l10nMap[$this->default]) && isset($this->_l10nCatalog[$this->_l10nMap[$this->default]])) {
$this->languagePath[] = $this->_l10nCatalog[$this->_l10nMap[$this->default]]['localeFallback'];
- } else if (isset($this->_l10nCatalog[$this->default])) {
+ } elseif (isset($this->_l10nCatalog[$this->default])) {
$this->languagePath[] = $this->_l10nCatalog[$this->default]['localeFallback'];
}
}
@@ -405,7 +405,7 @@ protected function _autoLanguage() {
if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey);
return true;
- } else if (strpos($langKey, '-') !== false) {
+ } elseif (strpos($langKey, '-') !== false) {
$langKey = substr($langKey, 0, 2);
if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey);
@@ -432,10 +432,10 @@ public function map($mixed = null) {
}
}
return $result;
- } else if (is_string($mixed)) {
+ } elseif (is_string($mixed)) {
if (strlen($mixed) === 2 && in_array($mixed, $this->_l10nMap)) {
return array_search($mixed, $this->_l10nMap);
- } else if (isset($this->_l10nMap[$mixed])) {
+ } elseif (isset($this->_l10nMap[$mixed])) {
return $this->_l10nMap[$mixed];
}
return false;
@@ -459,10 +459,10 @@ public function catalog($language = null) {
}
}
return $result;
- } else if (is_string($language)) {
+ } elseif (is_string($language)) {
if (isset($this->_l10nCatalog[$language])) {
return $this->_l10nCatalog[$language];
- } else if (isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
+ } elseif (isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
return $this->_l10nCatalog[$this->_l10nMap[$language]];
}
return false;
View
6 lib/Cake/Model/Behavior/ContainableBehavior.php
@@ -156,7 +156,7 @@ public function beforeFind($Model, $query) {
}
if (!$reset && empty($instance->__backOriginalAssociation)) {
$instance->__backOriginalAssociation = $backupBindings;
- } else if ($reset) {
+ } elseif ($reset) {
$instance->__backAssociation[$type] = $backupBindings[$type];
}
$instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]);
@@ -198,7 +198,7 @@ public function beforeFind($Model, $query) {
foreach ($mandatory[$Model->alias] as $field) {
if ($field == '--primaryKey--') {
$field = $Model->primaryKey;
- } else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
+ } elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
list($modelName, $field) = explode('.', $field);
if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) {
$field = $modelName . '.' . (
@@ -372,7 +372,7 @@ public function fieldDependencies($Model, $map, $fields = array()) {
foreach ($bindings as $dependency) {
if ($type == 'hasAndBelongsToMany') {
$fields[$parent][] = '--primaryKey--';
- } else if ($type == 'belongsTo') {
+ } elseif ($type == 'belongsTo') {
$fields[$parent][] = $dependency . '.--primaryKey--';
}
}
View
2  lib/Cake/Model/Behavior/TranslateBehavior.php
@@ -143,7 +143,7 @@ public function beforeFind($model, $query) {
$addFields = array();
if (empty($query['fields'])) {
$addFields = $fields;
- } else if (is_array($query['fields'])) {
+ } elseif (is_array($query['fields'])) {
foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key;
View
2  lib/Cake/Model/CakeSchema.php
@@ -575,7 +575,7 @@ protected function _values($values) {
foreach ($values as $key => $val) {
if (is_array($val)) {
$vals[] = "'{$key}' => array('" . implode("', '", $val) . "')";
- } else if (!is_numeric($key)) {
+ } elseif (!is_numeric($key)) {
$val = var_export($val, true);
$vals[] = "'{$key}' => {$val}";
}
View
2  lib/Cake/Model/Datasource/Database/Postgres.php
@@ -206,7 +206,7 @@ public function describe($model) {
if ($c->type == 'character varying') {
$length = null;
$type = 'text';
- } else if ($c->type == 'uuid') {
+ } elseif ($c->type == 'uuid') {
$length = 36;
} else {
$length = intval($c->oct_length);
View
2  lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -689,7 +689,7 @@ public function buildIndex($indexes, $table = null) {
foreach ($indexes as $name => $value) {
if ($name == 'PRIMARY') {
$join[] = 'PRIMARY KEY (' . $this->name($value['column']) . ')';
- } else if (isset($value['unique']) && $value['unique']) {
+ } elseif (isset($value['unique']) && $value['unique']) {
$out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE";
if (is_array($value['column'])) {
View
6 lib/Cake/Model/Datasource/DboSource.php
@@ -577,9 +577,9 @@ public function query() {
} else {
if (isset($args[1]) && $args[1] === true) {
return $this->fetchAll($args[0], true);
- } else if (isset($args[1]) && !is_array($args[1]) ) {
+ } elseif (isset($args[1]) && !is_array($args[1]) ) {
return $this->fetchAll($args[0], false);
- } else if (isset($args[1]) && is_array($args[1])) {
+ } elseif (isset($args[1]) && is_array($args[1])) {
if (isset($args[2])) {
$cache = $args[2];
} else {
@@ -1733,7 +1733,7 @@ public function renderStatement($type, $data) {
if (trim($indexes) !== '') {
$columns .= ',';
}
- return "CREATE TABLE {$table} (\n{$columns}{$indexes}){$tableParameters};";
+ return "CREATE TABLE {$table} (\n{$columns}{$indexes}) {$tableParameters};";
case 'alter':
return;
}
View
2  lib/Cake/Model/Model.php
@@ -793,7 +793,7 @@ public function __isset($name) {
$className = empty($this->__backAssociation[$type][$name]['className']) ?
$name : $this->__backAssociation[$type][$name]['className'];
break;
- } else if ($type == 'hasAndBelongsToMany') {
+ } elseif ($type == 'hasAndBelongsToMany') {
foreach ($this->{$type} as $k => $relation) {
if (empty($relation['with'])) {
continue;
View
2  lib/Cake/Network/CakeResponse.php
@@ -972,7 +972,7 @@ public function etag($tag = null, $weak = false) {
protected function _getUTCDate($time = null) {
if ($time instanceof DateTime) {
$result = clone $time;
- } else if (is_integer($time)) {
+ } elseif (is_integer($time)) {
$result = new DateTime(date('Y-m-d H:i:s', $time));
} else {
$result = new DateTime($time);
View
2  lib/Cake/Network/Http/HttpSocket.php
@@ -403,7 +403,7 @@ public function request($request = array()) {
$this->config['request']['cookies'][$Host] = array_merge($this->config['request']['cookies'][$Host], $this->response->cookies);
}
- if($this->request['redirect'] && $this->response->isRedirect()) {
+ if ($this->request['redirect'] && $this->response->isRedirect()) {
$request['uri'] = $this->response->getHeader('Location');
$request['redirect'] = is_int($this->request['redirect']) ? $this->request['redirect'] - 1 : $this->request['redirect'];
$this->response = $this->request($request);
View
2  lib/Cake/Test/Case/Console/Command/ApiShellTest.php
@@ -50,7 +50,7 @@ public function setUp() {
*
* @return void
*/
- public function testMethodNameDetection () {
+ public function testMethodNameDetection() {
$this->Shell->expects($this->any())->method('in')->will($this->returnValue('q'));
$this->Shell->expects($this->at(0))->method('out')->with('Controller');
View
2  lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
@@ -482,7 +482,7 @@ public function testRevoke() {
* @param bool $treesToo
* @return void
*/
- protected function __debug ($printTreesToo = false) {
+ protected function __debug($printTreesToo = false) {
$this->Acl->Aro->displayField = 'alias';
$this->Acl->Aco->displayField = 'alias';
$aros = $this->Acl->Aro->find('list', array('order' => 'lft'));
View
6 lib/Cake/Test/Case/Core/AppTest.php
@@ -599,7 +599,7 @@ public function testImportingHelpersFromAlternatePaths() {
*
* @return void
*/
- public function testFileLoading () {
+ public function testFileLoading() {
$file = App::import('File', 'RealFile', false, array(), CAKE . 'Config' . DS . 'config.php');
$this->assertTrue($file);
@@ -629,7 +629,7 @@ public function testFileLoadingWithArray() {
*
* @return void
*/
- public function testFileLoadingReturnValue () {
+ public function testFileLoadingReturnValue() {
$file = App::import('File', 'Name', false, array(), CAKE . 'Config' . DS . 'config.php', true);
$this->assertTrue(!empty($file));
@@ -648,7 +648,7 @@ public function testFileLoadingReturnValue () {
*
* @return void
*/
- public function testLoadingWithSearch () {
+ public function testLoadingWithSearch() {
$file = App::import('File', 'NewName', false, array(CAKE . 'Config' . DS), 'config.php');
$this->assertTrue($file);
View
10 lib/Cake/Test/Case/I18n/I18nTest.php
@@ -2314,7 +2314,7 @@ public function testMoRulesFourteen() {
*
* @return void
*/
- public function testSetLanguageWithSession () {
+ public function testSetLanguageWithSession() {
$_SESSION['Config']['language'] = 'po';
$singular = $this->__singular();
$this->assertEquals('Po (translated)', $singular);
@@ -2354,7 +2354,7 @@ public function testSetLanguageWithSession () {
*
* @return void
*/
- public function testNoCoreTranslation () {
+ public function testNoCoreTranslation() {
Configure::write('Config.language', 'po');
$singular = $this->__singular();
$this->assertEquals('Po (translated)', $singular);
@@ -2439,7 +2439,7 @@ public function testPluginTranslation() {
*
* @return void
*/
- public function testPoMultipleLineTranslation () {
+ public function testPoMultipleLineTranslation() {
Configure::write('Config.language', 'po');
$string = "This is a multiline translation\n";
@@ -2512,7 +2512,7 @@ public function testPoMultipleLineTranslation () {
*
* @return void
*/
- public function testPoNoTranslationNeeded () {
+ public function testPoNoTranslationNeeded() {
Configure::write('Config.language', 'po');
$result = __('No Translation needed');
$this->assertEquals('No Translation needed', $result);
@@ -2523,7 +2523,7 @@ public function testPoNoTranslationNeeded () {
*
* @return void
*/
- public function testPoQuotedString () {
+ public function testPoQuotedString() {
Configure::write('Config.language', 'po');
$expected = 'this is a "quoted string" (translated)';
$this->assertEquals($expected, __('this is a "quoted string"'));
View
4 lib/Cake/Test/Case/Model/models.php
@@ -183,7 +183,7 @@ class User extends CakeTestModel {
*
* @return bool
*/
- public function beforeFind ($queryData) {
+ public function beforeFind($queryData) {
if (!empty($queryData['lazyLoad'])) {
if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
throw new Exception('Unavailable associations');
@@ -257,7 +257,7 @@ public function beforeSave($options = array()) {
* @param mixed $title
* @return void
*/
- static function titleDuplicate ($title) {
+ static function titleDuplicate($title) {
if ($title === 'My Article Title') {
return false;
}
View
2  lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -20,7 +20,7 @@
if (!class_exists('AppController', false)) {
require_once CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS . 'AppController.php';
-} elseif (!defined('APP_CONTROLLER_EXISTS')){
+} elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true);
}
View
2  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -228,7 +228,7 @@ public function testMultipleNoCacheTagsInViewfile() {
*
* @return void
*/
- public function testComplexNoCache () {
+ public function testComplexNoCache() {
$this->Controller->cache_parsing();
$this->Controller->request->addParams(array(
'controller' => 'cache_test',
View
2  lib/Cake/Test/test_app/View/Emails/html/default.ctp
@@ -19,7 +19,7 @@
<?php
$content = explode("\n", $content);
-foreach($content as $line):
+foreach ($content as $line):
echo '<p> ' . $line . '</p>';
endforeach;
?>
View
2  lib/Cake/TestSuite/CakeTestLoader.php
@@ -61,7 +61,7 @@ protected static function _basePath($params) {
$result = null;
if (!empty($params['core'])) {
$result = CORE_TEST_CASES;
- } else if (!empty($params['plugin'])) {
+ } elseif (!empty($params['plugin'])) {
if (!CakePlugin::loaded($params['plugin'])) {
try {
CakePlugin::load($params['plugin']);
View
4 lib/Cake/TestSuite/CakeTestSuiteCommand.php
@@ -115,9 +115,7 @@ public function run(array $argv, $exit = true) {
if ($exit) {
if (isset($result) && $result->wasSuccessful()) {
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
- }
-
- else if (!isset($result) || $result->errorCount() > 0) {
+ } elseif (!isset($result) || $result->errorCount() > 0) {
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
}
View
2  lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
@@ -152,7 +152,7 @@ protected function _calculateCoveredLines($fileLines, $coverageData) {
if (is_array($coverageData[$lineno]) && !empty($coverageData[$lineno])) {
$covered++;
$total++;
- } else if ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
+ } elseif ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
$total++;
}
}
View
2  lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
@@ -154,7 +154,7 @@ function coverage_show_hide(selector) {
var element = document.getElementById(selector);
element.style.display = (element.style.display == 'none') ? '' : 'none';
}
- function coverage_toggle_all () {
+ function coverage_toggle_all() {
var divs = document.querySelectorAll('div.coverage-container');
var i = divs.length;
while (i--) {
View
2  lib/Cake/Utility/File.php
@@ -561,7 +561,7 @@ public function mime() {
$finfo = finfo_open(FILEINFO_MIME);
list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd()));
return $type;
- } else if (function_exists('mime_content_type')) {
+ } elseif (function_exists('mime_content_type')) {
return mime_content_type($this->pwd());
}
return false;
View
2  lib/Cake/Utility/Sanitize.php
@@ -214,7 +214,7 @@ public static function clean($data, $options = array()) {
if (is_string($options)) {
$options = array('connection' => $options);
- } else if (!is_array($options)) {
+ } elseif (!is_array($options)) {
$options = array();
}
View
8 lib/Cake/Utility/Set.php
@@ -477,7 +477,7 @@ public static function extract($path, $data = null, $options = array()) {
if (empty($tokens)) {
break;
}
- } while(1);
+ } while (1);
$r = array();
@@ -760,7 +760,7 @@ public static function check($data, $path = null) {
* @param mixed $val1 First value
* @param mixed $val2 Second value
* @return array Returns the key => value pairs that are not common in $val1 and $val2
- * The expression for this function is ($val1 - $val2) + ($val2 - ($val1 - $val2))
+ * The expression for this function is($val1 - $val2) + ($val2 - ($val1 - $val2))
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::diff
*/
public static function diff($val1, $val2 = null) {
@@ -963,7 +963,7 @@ public static function reverse($object) {
$out = array();
if ($object instanceof SimpleXMLElement) {
return Xml::toArray($object);
- } else if (is_object($object)) {
+ } elseif (is_object($object)) {
$keys = get_object_vars($object);
if (isset($keys['_name_'])) {
$identity = $keys['_name_'];
@@ -1205,7 +1205,7 @@ public static function get($input, $path = null) {
}
$return = $input;
- foreach($keys as $key) {
+ foreach ($keys as $key) {
if (!isset($return[$key])) {
return null;
}
View
4 lib/Cake/Utility/String.php
@@ -81,7 +81,7 @@ public static function uuid() {
if (function_exists('hphp_get_thread_id')) {
$pid = hphp_get_thread_id();
- } else if (function_exists('zend_thread_id')) {
+ } elseif (function_exists('zend_thread_id')) {
$pid = zend_thread_id();
} else {
$pid = getmypid();
@@ -458,7 +458,7 @@ class_exists('Multibyte');
if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) {
if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) {
array_unshift($openTags, $tag[2]);
- } else if (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) {
+ } elseif (preg_match('/<\/([\w]+)[^>]*>/s', $tag[0], $closeTag)) {
$pos = array_search($closeTag[1], $openTags);
if ($pos !== false) {
array_splice($openTags, $pos, 1);
View
2  lib/Cake/View/Helper/FormHelper.php
@@ -2523,7 +2523,7 @@ protected function _generateOptions($name, $options = array()) {
$data['10'] = __d('cake', 'October');
$data['11'] = __d('cake', 'November');
$data['12'] = __d('cake', 'December');
- } else if (is_array($options['monthNames'])) {
+ } elseif (is_array($options['monthNames'])) {
$data = $options['monthNames'];
} else {
for ($m = 1; $m <= 12; $m++) {
View
2  lib/Cake/View/Helper/HtmlHelper.php
@@ -1136,7 +1136,7 @@ protected function _nestedListItem($items, $options, $itemOptions, $tag) {
}
if (isset($itemOptions['even']) && $index % 2 == 0) {
$itemOptions['class'] = $itemOptions['even'];
- } else if (isset($itemOptions['odd']) && $index % 2 != 0) {
+ } elseif (isset($itemOptions['odd']) && $index % 2 != 0) {
$itemOptions['class'] = $itemOptions['odd'];
}
$out .= sprintf($this->_tags['li'], $this->_parseAttributes($itemOptions, array('even', 'odd'), ' ', ''), $item);
View
2  lib/Cake/View/Helper/RssHelper.php
@@ -220,7 +220,7 @@ public function item($att = array(), $elements = array()) {
}
$elements[$key] = implode('', $categories);
continue 2;
- } else if (is_array($val) && isset($val['domain'])) {
+ } elseif (is_array($val) && isset($val['domain'])) {
$attrib['domain'] = $val['domain'];
}
break;
View
4 lib/Cake/View/MediaView.php
@@ -41,7 +41,7 @@
*
* {{{
* class ExampleController extends AppController {
- * public function download () {
+ * public function download() {
* $this->viewClass = 'Media';
* $params = array(
* 'id' => 'example.zip',
@@ -142,7 +142,7 @@ public function render($view = null, $layout = null) {
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) {
$contentType = 'application/octetstream';
- } else if (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
+ } elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
$contentType = 'application/force-download';
}
View
2  lib/Cake/View/View.php
@@ -952,7 +952,7 @@ protected function _getViewFileName($name = null) {
return $name;
}
$name = trim($name, DS);
- } else if ($name[0] === '.') {
+ } elseif ($name[0] === '.') {
$name = substr($name, 3);
} elseif (!$plugin) {
$name = $this->viewPath . DS . $subDir . $name;
Please sign in to comment.
Something went wrong with that request. Please try again.