From e94d307ee152171c9d4ce937a085c1947633e944 Mon Sep 17 00:00:00 2001 From: euromark Date: Thu, 23 Feb 2012 14:38:02 +0100 Subject: [PATCH] code conventions --- lib/Cake/Cache/Engine/XcacheEngine.php | 2 +- lib/Cake/Console/Command/Task/DbConfigTask.php | 2 +- lib/Cake/Console/Command/Task/ExtractTask.php | 6 +++--- lib/Cake/Core/App.php | 4 ++-- lib/Cake/Event/CakeEventManager.php | 4 ++-- lib/Cake/I18n/L10n.php | 16 ++++++++-------- lib/Cake/Model/Behavior/ContainableBehavior.php | 6 +++--- lib/Cake/Model/Behavior/TranslateBehavior.php | 2 +- lib/Cake/Model/CakeSchema.php | 2 +- lib/Cake/Model/Datasource/Database/Postgres.php | 2 +- lib/Cake/Model/Datasource/Database/Sqlserver.php | 2 +- lib/Cake/Model/Datasource/DboSource.php | 6 +++--- lib/Cake/Model/Model.php | 2 +- lib/Cake/Network/CakeResponse.php | 2 +- lib/Cake/Network/Http/HttpSocket.php | 2 +- .../Test/Case/Console/Command/ApiShellTest.php | 2 +- .../Case/Controller/Component/Acl/DbAclTest.php | 2 +- lib/Cake/Test/Case/Core/AppTest.php | 6 +++--- lib/Cake/Test/Case/I18n/I18nTest.php | 10 +++++----- lib/Cake/Test/Case/Model/models.php | 4 ++-- lib/Cake/Test/Case/Routing/DispatcherTest.php | 2 +- .../Test/Case/View/Helper/CacheHelperTest.php | 2 +- .../Test/test_app/View/Emails/html/default.ctp | 2 +- lib/Cake/TestSuite/CakeTestLoader.php | 2 +- lib/Cake/TestSuite/CakeTestSuiteCommand.php | 4 +--- .../TestSuite/Coverage/BaseCoverageReport.php | 2 +- .../TestSuite/Coverage/HtmlCoverageReport.php | 2 +- lib/Cake/Utility/File.php | 2 +- lib/Cake/Utility/Sanitize.php | 2 +- lib/Cake/Utility/Set.php | 8 ++++---- lib/Cake/Utility/String.php | 4 ++-- lib/Cake/View/Helper/FormHelper.php | 2 +- lib/Cake/View/Helper/HtmlHelper.php | 2 +- lib/Cake/View/Helper/RssHelper.php | 2 +- lib/Cake/View/MediaView.php | 4 ++-- lib/Cake/View/View.php | 2 +- 36 files changed, 63 insertions(+), 65 deletions(-) diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index 72100f76d..950d47945 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/lib/Cake/Cache/Engine/XcacheEngine.php @@ -165,7 +165,7 @@ class XcacheEngine extends CacheEngine { } 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; diff --git a/lib/Cake/Console/Command/Task/DbConfigTask.php b/lib/Cake/Console/Command/Task/DbConfigTask.php index c9cdfd057..45367f16d 100644 --- a/lib/Cake/Console/Command/Task/DbConfigTask.php +++ b/lib/Cake/Console/Command/Task/DbConfigTask.php @@ -100,7 +100,7 @@ class DbConfigTask extends AppShell { 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')); } diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 5024478c6..bf7547f07 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -118,7 +118,7 @@ class ExtractTask extends AppShell { } 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 @@ class ExtractTask extends AppShell { 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 @@ class ExtractTask extends AppShell { $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++; diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 6d37fbd3e..faf4afb45 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -652,7 +652,7 @@ class App { 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 @@ class App { $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)) { diff --git a/lib/Cake/Event/CakeEventManager.php b/lib/Cake/Event/CakeEventManager.php index cb29d4e7e..b141d8915 100644 --- a/lib/Cake/Event/CakeEventManager.php +++ b/lib/Cake/Event/CakeEventManager.php @@ -126,7 +126,7 @@ class CakeEventManager { $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 @@ class CakeEventManager { $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) { diff --git a/lib/Cake/I18n/L10n.php b/lib/Cake/I18n/L10n.php index 9c973b0a7..b621c06b3 100644 --- a/lib/Cake/I18n/L10n.php +++ b/lib/Cake/I18n/L10n.php @@ -355,9 +355,9 @@ class L10n { $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 @@ class L10n { 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 @@ class L10n { 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 @@ class L10n { } } 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 @@ class L10n { } } 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; diff --git a/lib/Cake/Model/Behavior/ContainableBehavior.php b/lib/Cake/Model/Behavior/ContainableBehavior.php index fbffc781f..cce1b4a96 100644 --- a/lib/Cake/Model/Behavior/ContainableBehavior.php +++ b/lib/Cake/Model/Behavior/ContainableBehavior.php @@ -156,7 +156,7 @@ class ContainableBehavior extends ModelBehavior { } 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 @@ class ContainableBehavior extends ModelBehavior { 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 @@ class ContainableBehavior extends ModelBehavior { foreach ($bindings as $dependency) { if ($type == 'hasAndBelongsToMany') { $fields[$parent][] = '--primaryKey--'; - } else if ($type == 'belongsTo') { + } elseif ($type == 'belongsTo') { $fields[$parent][] = $dependency . '.--primaryKey--'; } } diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index 9705d0f76..392068f1b 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -143,7 +143,7 @@ class TranslateBehavior extends ModelBehavior { $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; diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php index 72694a238..a92eca848 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/lib/Cake/Model/CakeSchema.php @@ -575,7 +575,7 @@ class CakeSchema extends Object { 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}"; } diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 544f61414..c2147b08f 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -206,7 +206,7 @@ class Postgres extends DboSource { 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); diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index 0150879f8..687b8e1e6 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -689,7 +689,7 @@ class Sqlserver extends DboSource { 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'])) { diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 877cea30d..870cbbfbb 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -577,9 +577,9 @@ class DboSource extends DataSource { } 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 @@ class DboSource extends DataSource { if (trim($indexes) !== '') { $columns .= ','; } - return "CREATE TABLE {$table} (\n{$columns}{$indexes}){$tableParameters};"; + return "CREATE TABLE {$table} (\n{$columns}{$indexes}) {$tableParameters};"; case 'alter': return; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 11011c877..ea0112484 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -793,7 +793,7 @@ class Model extends Object implements CakeEventListener { $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; diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 06a3cbee9..d5d0a3284 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -972,7 +972,7 @@ class CakeResponse { 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); diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index 0e0cdae75..d71322d5b 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -403,7 +403,7 @@ class HttpSocket extends CakeSocket { $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); diff --git a/lib/Cake/Test/Case/Console/Command/ApiShellTest.php b/lib/Cake/Test/Case/Console/Command/ApiShellTest.php index a0ab4c426..54e0e075b 100644 --- a/lib/Cake/Test/Case/Console/Command/ApiShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/ApiShellTest.php @@ -50,7 +50,7 @@ class ApiShellTest extends CakeTestCase { * * @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'); diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php index f278f7807..167d45789 100644 --- a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php +++ b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php @@ -482,7 +482,7 @@ class DbAclTest extends CakeTestCase { * @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')); diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 3b25c6082..fd00c655b 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -599,7 +599,7 @@ class AppTest extends CakeTestCase { * * @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 @@ class AppTest extends CakeTestCase { * * @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 @@ class AppTest extends CakeTestCase { * * @return void */ - public function testLoadingWithSearch () { + public function testLoadingWithSearch() { $file = App::import('File', 'NewName', false, array(CAKE . 'Config' . DS), 'config.php'); $this->assertTrue($file); diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php index 772dda5ec..9fd6512c5 100644 --- a/lib/Cake/Test/Case/I18n/I18nTest.php +++ b/lib/Cake/Test/Case/I18n/I18nTest.php @@ -2314,7 +2314,7 @@ class I18nTest extends CakeTestCase { * * @return void */ - public function testSetLanguageWithSession () { + public function testSetLanguageWithSession() { $_SESSION['Config']['language'] = 'po'; $singular = $this->__singular(); $this->assertEquals('Po (translated)', $singular); @@ -2354,7 +2354,7 @@ class I18nTest extends CakeTestCase { * * @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 @@ class I18nTest extends CakeTestCase { * * @return void */ - public function testPoMultipleLineTranslation () { + public function testPoMultipleLineTranslation() { Configure::write('Config.language', 'po'); $string = "This is a multiline translation\n"; @@ -2512,7 +2512,7 @@ class I18nTest extends CakeTestCase { * * @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 @@ class I18nTest extends CakeTestCase { * * @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"')); diff --git a/lib/Cake/Test/Case/Model/models.php b/lib/Cake/Test/Case/Model/models.php index 9f583066e..2eee6fd97 100644 --- a/lib/Cake/Test/Case/Model/models.php +++ b/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 @@ class Article extends CakeTestModel { * @param mixed $title * @return void */ - static function titleDuplicate ($title) { + static function titleDuplicate($title) { if ($title === 'My Article Title') { return false; } diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index b38bd364d..57351dbcd 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -20,7 +20,7 @@ App::uses('Dispatcher', 'Routing'); 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); } diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php index fe0999f19..1d4a5afac 100644 --- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php @@ -228,7 +228,7 @@ class CacheHelperTest extends CakeTestCase { * * @return void */ - public function testComplexNoCache () { + public function testComplexNoCache() { $this->Controller->cache_parsing(); $this->Controller->request->addParams(array( 'controller' => 'cache_test', diff --git a/lib/Cake/Test/test_app/View/Emails/html/default.ctp b/lib/Cake/Test/test_app/View/Emails/html/default.ctp index 8d94f13a9..0f59cc229 100644 --- a/lib/Cake/Test/test_app/View/Emails/html/default.ctp +++ b/lib/Cake/Test/test_app/View/Emails/html/default.ctp @@ -19,7 +19,7 @@ ' . $line . '

'; endforeach; ?> \ No newline at end of file diff --git a/lib/Cake/TestSuite/CakeTestLoader.php b/lib/Cake/TestSuite/CakeTestLoader.php index 35d10daf0..bca88d4ca 100644 --- a/lib/Cake/TestSuite/CakeTestLoader.php +++ b/lib/Cake/TestSuite/CakeTestLoader.php @@ -61,7 +61,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader { $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']); diff --git a/lib/Cake/TestSuite/CakeTestSuiteCommand.php b/lib/Cake/TestSuite/CakeTestSuiteCommand.php index 7dd7e351d..29953b5d2 100644 --- a/lib/Cake/TestSuite/CakeTestSuiteCommand.php +++ b/lib/Cake/TestSuite/CakeTestSuiteCommand.php @@ -115,9 +115,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command { 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); } diff --git a/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php b/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php index 18e54d8b4..a8e244a6b 100644 --- a/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php +++ b/lib/Cake/TestSuite/Coverage/BaseCoverageReport.php @@ -152,7 +152,7 @@ abstract class BaseCoverageReport { 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++; } } diff --git a/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php b/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php index 9dc7efc5a..d38cbc516 100644 --- a/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php +++ b/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php @@ -154,7 +154,7 @@ HTML; 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--) { diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index 0827663c4..7b1b3a500 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -561,7 +561,7 @@ class File { $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; diff --git a/lib/Cake/Utility/Sanitize.php b/lib/Cake/Utility/Sanitize.php index a2f3ed959..c0b7130e4 100644 --- a/lib/Cake/Utility/Sanitize.php +++ b/lib/Cake/Utility/Sanitize.php @@ -214,7 +214,7 @@ class Sanitize { if (is_string($options)) { $options = array('connection' => $options); - } else if (!is_array($options)) { + } elseif (!is_array($options)) { $options = array(); } diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index a911a0b05..6633968c1 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -477,7 +477,7 @@ class Set { if (empty($tokens)) { break; } - } while(1); + } while (1); $r = array(); @@ -760,7 +760,7 @@ class Set { * @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 @@ class Set { $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 @@ class Set { } $return = $input; - foreach($keys as $key) { + foreach ($keys as $key) { if (!isset($return[$key])) { return null; } diff --git a/lib/Cake/Utility/String.php b/lib/Cake/Utility/String.php index 94234a399..47ff74be1 100644 --- a/lib/Cake/Utility/String.php +++ b/lib/Cake/Utility/String.php @@ -81,7 +81,7 @@ class String { 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 String { 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); diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index ad7817b0e..8e7ef063b 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -2523,7 +2523,7 @@ class FormHelper extends AppHelper { $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++) { diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 7f18b24e0..7b0d9eb38 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -1136,7 +1136,7 @@ class HtmlHelper extends AppHelper { } 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); diff --git a/lib/Cake/View/Helper/RssHelper.php b/lib/Cake/View/Helper/RssHelper.php index 3c29993e8..f7c7a305d 100644 --- a/lib/Cake/View/Helper/RssHelper.php +++ b/lib/Cake/View/Helper/RssHelper.php @@ -220,7 +220,7 @@ class RssHelper extends AppHelper { } $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; diff --git a/lib/Cake/View/MediaView.php b/lib/Cake/View/MediaView.php index 822e2beb8..7248b940b 100644 --- a/lib/Cake/View/MediaView.php +++ b/lib/Cake/View/MediaView.php @@ -41,7 +41,7 @@ App::uses('CakeRequest', 'Network'); * * {{{ * class ExampleController extends AppController { - * public function download () { + * public function download() { * $this->viewClass = 'Media'; * $params = array( * 'id' => 'example.zip', @@ -142,7 +142,7 @@ class MediaView extends View { 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'; } diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 741f9f95a..1e978ed24 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -952,7 +952,7 @@ class View extends Object { 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;