code conventions

This commit is contained in:
euromark 2012-02-23 14:38:02 +01:00 committed by mark_story
parent ed22c17eba
commit e94d307ee1
36 changed files with 63 additions and 65 deletions

View file

@ -165,7 +165,7 @@ class XcacheEngine extends CacheEngine {
} }
if (!empty($this->settings[$setting])) { if (!empty($this->settings[$setting])) {
$_SERVER[$key] = $this->settings[$setting]; $_SERVER[$key] = $this->settings[$setting];
} else if (!empty($this->settings[$key])) { } elseif (!empty($this->settings[$key])) {
$_SERVER[$key] = $this->settings[$key]; $_SERVER[$key] = $this->settings[$key];
} else { } else {
$_SERVER[$key] = $value; $_SERVER[$key] = $value;

View file

@ -100,7 +100,7 @@ class DbConfigTask extends AppShell {
if (preg_match('/[^a-z0-9_]/i', $name)) { if (preg_match('/[^a-z0-9_]/i', $name)) {
$name = ''; $name = '';
$this->out(__d('cake_console', 'The name may only contain unaccented latin characters, numbers or underscores')); $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 = ''; $name = '';
$this->out(__d('cake_console', 'The name must start with an unaccented latin character or an underscore')); $this->out(__d('cake_console', 'The name must start with an unaccented latin character or an underscore'));
} }

View file

@ -118,7 +118,7 @@ class ExtractTask extends AppShell {
} }
if (isset($this->params['paths'])) { if (isset($this->params['paths'])) {
$this->_paths = explode(',', $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']); $plugin = Inflector::camelize($this->params['plugin']);
if (!CakePlugin::loaded($plugin)) { if (!CakePlugin::loaded($plugin)) {
CakePlugin::load($plugin); CakePlugin::load($plugin);
@ -159,7 +159,7 @@ class ExtractTask extends AppShell {
if (isset($this->params['output'])) { if (isset($this->params['output'])) {
$this->_output = $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'; $this->_output = $this->_paths[0] . DS . 'Locale';
} else { } else {
$message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0] . DS . 'Locale'); $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++; $position++;
} }
$strings[] = $string; $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]); $strings[] = $this->_formatString($this->_tokens[$position][1]);
} }
$position++; $position++;

View file

@ -652,7 +652,7 @@ class App {
protected static function _loadClass($name, $plugin, $type, $originalType, $parent) { protected static function _loadClass($name, $plugin, $type, $originalType, $parent) {
if ($type == 'Console/Command' && $name == 'Shell') { if ($type == 'Console/Command' && $name == 'Shell') {
$type = 'Console'; $type = 'Console';
} else if (isset(self::$types[$originalType]['suffix'])) { } elseif (isset(self::$types[$originalType]['suffix'])) {
$suffix = self::$types[$originalType]['suffix']; $suffix = self::$types[$originalType]['suffix'];
$name .= ($suffix == $name) ? '' : $suffix; $name .= ($suffix == $name) ? '' : $suffix;
} }
@ -691,7 +691,7 @@ class App {
$mapped = self::_mapped($name, $plugin); $mapped = self::_mapped($name, $plugin);
if ($mapped) { if ($mapped) {
$file = $mapped; $file = $mapped;
} else if (!empty($search)) { } elseif (!empty($search)) {
foreach ($search as $path) { foreach ($search as $path) {
$found = false; $found = false;
if (file_exists($path . $file)) { if (file_exists($path . $file)) {

View file

@ -126,7 +126,7 @@ class CakeEventManager {
$method = $function; $method = $function;
if (is_array($function) && isset($function['callable'])) { if (is_array($function) && isset($function['callable'])) {
list($method, $options) = $this->_extractCallable($function, $subscriber); 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) { foreach ($function as $f) {
list($method, $options) = $this->_extractCallable($f, $subscriber); list($method, $options) = $this->_extractCallable($f, $subscriber);
$this->attach($method, $eventKey, $options); $this->attach($method, $eventKey, $options);
@ -198,7 +198,7 @@ class CakeEventManager {
$events = $subscriber->implementedEvents(); $events = $subscriber->implementedEvents();
if (!empty($eventKey) && empty($events[$eventKey])) { if (!empty($eventKey) && empty($events[$eventKey])) {
return; return;
} else if (!empty($eventKey)) { } elseif (!empty($eventKey)) {
$events = array($eventKey => $events[$eventKey]); $events = array($eventKey => $events[$eventKey]);
} }
foreach ($events as $key => $function) { foreach ($events as $key => $function) {

View file

@ -355,9 +355,9 @@ class L10n {
$langKey = null; $langKey = null;
if ($language !== null && isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) { if ($language !== null && isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
$langKey = $this->_l10nMap[$language]; $langKey = $this->_l10nMap[$language];
} else if ($language !== null && isset($this->_l10nCatalog[$language])) { } elseif ($language !== null && isset($this->_l10nCatalog[$language])) {
$langKey = $language; $langKey = $language;
} else if (defined('DEFAULT_LANGUAGE')) { } elseif (defined('DEFAULT_LANGUAGE')) {
$langKey = $language = DEFAULT_LANGUAGE; $langKey = $language = DEFAULT_LANGUAGE;
} }
@ -379,7 +379,7 @@ class L10n {
if ($this->default) { if ($this->default) {
if (isset($this->_l10nMap[$this->default]) && isset($this->_l10nCatalog[$this->_l10nMap[$this->default]])) { if (isset($this->_l10nMap[$this->default]) && isset($this->_l10nCatalog[$this->_l10nMap[$this->default]])) {
$this->languagePath[] = $this->_l10nCatalog[$this->_l10nMap[$this->default]]['localeFallback']; $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']; $this->languagePath[] = $this->_l10nCatalog[$this->default]['localeFallback'];
} }
} }
@ -405,7 +405,7 @@ class L10n {
if (isset($this->_l10nCatalog[$langKey])) { if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey); $this->_setLanguage($langKey);
return true; return true;
} else if (strpos($langKey, '-') !== false) { } elseif (strpos($langKey, '-') !== false) {
$langKey = substr($langKey, 0, 2); $langKey = substr($langKey, 0, 2);
if (isset($this->_l10nCatalog[$langKey])) { if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey); $this->_setLanguage($langKey);
@ -432,10 +432,10 @@ class L10n {
} }
} }
return $result; return $result;
} else if (is_string($mixed)) { } elseif (is_string($mixed)) {
if (strlen($mixed) === 2 && in_array($mixed, $this->_l10nMap)) { if (strlen($mixed) === 2 && in_array($mixed, $this->_l10nMap)) {
return array_search($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 $this->_l10nMap[$mixed];
} }
return false; return false;
@ -459,10 +459,10 @@ class L10n {
} }
} }
return $result; return $result;
} else if (is_string($language)) { } elseif (is_string($language)) {
if (isset($this->_l10nCatalog[$language])) { if (isset($this->_l10nCatalog[$language])) {
return $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 $this->_l10nCatalog[$this->_l10nMap[$language]];
} }
return false; return false;

View file

@ -156,7 +156,7 @@ class ContainableBehavior extends ModelBehavior {
} }
if (!$reset && empty($instance->__backOriginalAssociation)) { if (!$reset && empty($instance->__backOriginalAssociation)) {
$instance->__backOriginalAssociation = $backupBindings; $instance->__backOriginalAssociation = $backupBindings;
} else if ($reset) { } elseif ($reset) {
$instance->__backAssociation[$type] = $backupBindings[$type]; $instance->__backAssociation[$type] = $backupBindings[$type];
} }
$instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]); $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) { foreach ($mandatory[$Model->alias] as $field) {
if ($field == '--primaryKey--') { if ($field == '--primaryKey--') {
$field = $Model->primaryKey; $field = $Model->primaryKey;
} else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) { } elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
list($modelName, $field) = explode('.', $field); list($modelName, $field) = explode('.', $field);
if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) { if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) {
$field = $modelName . '.' . ( $field = $modelName . '.' . (
@ -372,7 +372,7 @@ class ContainableBehavior extends ModelBehavior {
foreach ($bindings as $dependency) { foreach ($bindings as $dependency) {
if ($type == 'hasAndBelongsToMany') { if ($type == 'hasAndBelongsToMany') {
$fields[$parent][] = '--primaryKey--'; $fields[$parent][] = '--primaryKey--';
} else if ($type == 'belongsTo') { } elseif ($type == 'belongsTo') {
$fields[$parent][] = $dependency . '.--primaryKey--'; $fields[$parent][] = $dependency . '.--primaryKey--';
} }
} }

View file

@ -143,7 +143,7 @@ class TranslateBehavior extends ModelBehavior {
$addFields = array(); $addFields = array();
if (empty($query['fields'])) { if (empty($query['fields'])) {
$addFields = $fields; $addFields = $fields;
} else if (is_array($query['fields'])) { } elseif (is_array($query['fields'])) {
foreach ($fields as $key => $value) { foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key; $field = (is_numeric($key)) ? $value : $key;

View file

@ -575,7 +575,7 @@ class CakeSchema extends Object {
foreach ($values as $key => $val) { foreach ($values as $key => $val) {
if (is_array($val)) { if (is_array($val)) {
$vals[] = "'{$key}' => array('" . implode("', '", $val) . "')"; $vals[] = "'{$key}' => array('" . implode("', '", $val) . "')";
} else if (!is_numeric($key)) { } elseif (!is_numeric($key)) {
$val = var_export($val, true); $val = var_export($val, true);
$vals[] = "'{$key}' => {$val}"; $vals[] = "'{$key}' => {$val}";
} }

View file

@ -206,7 +206,7 @@ class Postgres extends DboSource {
if ($c->type == 'character varying') { if ($c->type == 'character varying') {
$length = null; $length = null;
$type = 'text'; $type = 'text';
} else if ($c->type == 'uuid') { } elseif ($c->type == 'uuid') {
$length = 36; $length = 36;
} else { } else {
$length = intval($c->oct_length); $length = intval($c->oct_length);

View file

@ -689,7 +689,7 @@ class Sqlserver extends DboSource {
foreach ($indexes as $name => $value) { foreach ($indexes as $name => $value) {
if ($name == 'PRIMARY') { if ($name == 'PRIMARY') {
$join[] = 'PRIMARY KEY (' . $this->name($value['column']) . ')'; $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"; $out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE";
if (is_array($value['column'])) { if (is_array($value['column'])) {

View file

@ -577,9 +577,9 @@ class DboSource extends DataSource {
} else { } else {
if (isset($args[1]) && $args[1] === true) { if (isset($args[1]) && $args[1] === true) {
return $this->fetchAll($args[0], 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); 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])) { if (isset($args[2])) {
$cache = $args[2]; $cache = $args[2];
} else { } else {
@ -1733,7 +1733,7 @@ class DboSource extends DataSource {
if (trim($indexes) !== '') { if (trim($indexes) !== '') {
$columns .= ','; $columns .= ',';
} }
return "CREATE TABLE {$table} (\n{$columns}{$indexes}){$tableParameters};"; return "CREATE TABLE {$table} (\n{$columns}{$indexes}) {$tableParameters};";
case 'alter': case 'alter':
return; return;
} }

View file

@ -793,7 +793,7 @@ class Model extends Object implements CakeEventListener {
$className = empty($this->__backAssociation[$type][$name]['className']) ? $className = empty($this->__backAssociation[$type][$name]['className']) ?
$name : $this->__backAssociation[$type][$name]['className']; $name : $this->__backAssociation[$type][$name]['className'];
break; break;
} else if ($type == 'hasAndBelongsToMany') { } elseif ($type == 'hasAndBelongsToMany') {
foreach ($this->{$type} as $k => $relation) { foreach ($this->{$type} as $k => $relation) {
if (empty($relation['with'])) { if (empty($relation['with'])) {
continue; continue;

View file

@ -972,7 +972,7 @@ class CakeResponse {
protected function _getUTCDate($time = null) { protected function _getUTCDate($time = null) {
if ($time instanceof DateTime) { if ($time instanceof DateTime) {
$result = clone $time; $result = clone $time;
} else if (is_integer($time)) { } elseif (is_integer($time)) {
$result = new DateTime(date('Y-m-d H:i:s', $time)); $result = new DateTime(date('Y-m-d H:i:s', $time));
} else { } else {
$result = new DateTime($time); $result = new DateTime($time);

View file

@ -403,7 +403,7 @@ class HttpSocket extends CakeSocket {
$this->config['request']['cookies'][$Host] = array_merge($this->config['request']['cookies'][$Host], $this->response->cookies); $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['uri'] = $this->response->getHeader('Location');
$request['redirect'] = is_int($this->request['redirect']) ? $this->request['redirect'] - 1 : $this->request['redirect']; $request['redirect'] = is_int($this->request['redirect']) ? $this->request['redirect'] - 1 : $this->request['redirect'];
$this->response = $this->request($request); $this->response = $this->request($request);

View file

@ -50,7 +50,7 @@ class ApiShellTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testMethodNameDetection () { public function testMethodNameDetection() {
$this->Shell->expects($this->any())->method('in')->will($this->returnValue('q')); $this->Shell->expects($this->any())->method('in')->will($this->returnValue('q'));
$this->Shell->expects($this->at(0))->method('out')->with('Controller'); $this->Shell->expects($this->at(0))->method('out')->with('Controller');

View file

@ -482,7 +482,7 @@ class DbAclTest extends CakeTestCase {
* @param bool $treesToo * @param bool $treesToo
* @return void * @return void
*/ */
protected function __debug ($printTreesToo = false) { protected function __debug($printTreesToo = false) {
$this->Acl->Aro->displayField = 'alias'; $this->Acl->Aro->displayField = 'alias';
$this->Acl->Aco->displayField = 'alias'; $this->Acl->Aco->displayField = 'alias';
$aros = $this->Acl->Aro->find('list', array('order' => 'lft')); $aros = $this->Acl->Aro->find('list', array('order' => 'lft'));

View file

@ -599,7 +599,7 @@ class AppTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testFileLoading () { public function testFileLoading() {
$file = App::import('File', 'RealFile', false, array(), CAKE . 'Config' . DS . 'config.php'); $file = App::import('File', 'RealFile', false, array(), CAKE . 'Config' . DS . 'config.php');
$this->assertTrue($file); $this->assertTrue($file);
@ -629,7 +629,7 @@ class AppTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testFileLoadingReturnValue () { public function testFileLoadingReturnValue() {
$file = App::import('File', 'Name', false, array(), CAKE . 'Config' . DS . 'config.php', true); $file = App::import('File', 'Name', false, array(), CAKE . 'Config' . DS . 'config.php', true);
$this->assertTrue(!empty($file)); $this->assertTrue(!empty($file));
@ -648,7 +648,7 @@ class AppTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testLoadingWithSearch () { public function testLoadingWithSearch() {
$file = App::import('File', 'NewName', false, array(CAKE . 'Config' . DS), 'config.php'); $file = App::import('File', 'NewName', false, array(CAKE . 'Config' . DS), 'config.php');
$this->assertTrue($file); $this->assertTrue($file);

View file

@ -2314,7 +2314,7 @@ class I18nTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testSetLanguageWithSession () { public function testSetLanguageWithSession() {
$_SESSION['Config']['language'] = 'po'; $_SESSION['Config']['language'] = 'po';
$singular = $this->__singular(); $singular = $this->__singular();
$this->assertEquals('Po (translated)', $singular); $this->assertEquals('Po (translated)', $singular);
@ -2354,7 +2354,7 @@ class I18nTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testNoCoreTranslation () { public function testNoCoreTranslation() {
Configure::write('Config.language', 'po'); Configure::write('Config.language', 'po');
$singular = $this->__singular(); $singular = $this->__singular();
$this->assertEquals('Po (translated)', $singular); $this->assertEquals('Po (translated)', $singular);
@ -2439,7 +2439,7 @@ class I18nTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testPoMultipleLineTranslation () { public function testPoMultipleLineTranslation() {
Configure::write('Config.language', 'po'); Configure::write('Config.language', 'po');
$string = "This is a multiline translation\n"; $string = "This is a multiline translation\n";
@ -2512,7 +2512,7 @@ class I18nTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testPoNoTranslationNeeded () { public function testPoNoTranslationNeeded() {
Configure::write('Config.language', 'po'); Configure::write('Config.language', 'po');
$result = __('No Translation needed'); $result = __('No Translation needed');
$this->assertEquals('No Translation needed', $result); $this->assertEquals('No Translation needed', $result);
@ -2523,7 +2523,7 @@ class I18nTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testPoQuotedString () { public function testPoQuotedString() {
Configure::write('Config.language', 'po'); Configure::write('Config.language', 'po');
$expected = 'this is a "quoted string" (translated)'; $expected = 'this is a "quoted string" (translated)';
$this->assertEquals($expected, __('this is a "quoted string"')); $this->assertEquals($expected, __('this is a "quoted string"'));

View file

@ -183,7 +183,7 @@ class User extends CakeTestModel {
* *
* @return bool * @return bool
*/ */
public function beforeFind ($queryData) { public function beforeFind($queryData) {
if (!empty($queryData['lazyLoad'])) { if (!empty($queryData['lazyLoad'])) {
if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) { if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
throw new Exception('Unavailable associations'); throw new Exception('Unavailable associations');
@ -257,7 +257,7 @@ class Article extends CakeTestModel {
* @param mixed $title * @param mixed $title
* @return void * @return void
*/ */
static function titleDuplicate ($title) { static function titleDuplicate($title) {
if ($title === 'My Article Title') { if ($title === 'My Article Title') {
return false; return false;
} }

View file

@ -20,7 +20,7 @@ App::uses('Dispatcher', 'Routing');
if (!class_exists('AppController', false)) { if (!class_exists('AppController', false)) {
require_once CAKE . 'Test' . DS . 'test_app' . DS . 'Controller' . DS . 'AppController.php'; 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); define('APP_CONTROLLER_EXISTS', true);
} }

View file

@ -228,7 +228,7 @@ class CacheHelperTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testComplexNoCache () { public function testComplexNoCache() {
$this->Controller->cache_parsing(); $this->Controller->cache_parsing();
$this->Controller->request->addParams(array( $this->Controller->request->addParams(array(
'controller' => 'cache_test', 'controller' => 'cache_test',

View file

@ -19,7 +19,7 @@
<?php <?php
$content = explode("\n", $content); $content = explode("\n", $content);
foreach($content as $line): foreach ($content as $line):
echo '<p> ' . $line . '</p>'; echo '<p> ' . $line . '</p>';
endforeach; endforeach;
?> ?>

View file

@ -61,7 +61,7 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
$result = null; $result = null;
if (!empty($params['core'])) { if (!empty($params['core'])) {
$result = CORE_TEST_CASES; $result = CORE_TEST_CASES;
} else if (!empty($params['plugin'])) { } elseif (!empty($params['plugin'])) {
if (!CakePlugin::loaded($params['plugin'])) { if (!CakePlugin::loaded($params['plugin'])) {
try { try {
CakePlugin::load($params['plugin']); CakePlugin::load($params['plugin']);

View file

@ -115,9 +115,7 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
if ($exit) { if ($exit) {
if (isset($result) && $result->wasSuccessful()) { if (isset($result) && $result->wasSuccessful()) {
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT); exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
} } elseif (!isset($result) || $result->errorCount() > 0) {
else if (!isset($result) || $result->errorCount() > 0) {
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT); exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
} }

View file

@ -152,7 +152,7 @@ abstract class BaseCoverageReport {
if (is_array($coverageData[$lineno]) && !empty($coverageData[$lineno])) { if (is_array($coverageData[$lineno]) && !empty($coverageData[$lineno])) {
$covered++; $covered++;
$total++; $total++;
} else if ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) { } elseif ($coverageData[$lineno] === -1 || $coverageData[$lineno] === array()) {
$total++; $total++;
} }
} }

View file

@ -154,7 +154,7 @@ HTML;
var element = document.getElementById(selector); var element = document.getElementById(selector);
element.style.display = (element.style.display == 'none') ? '' : 'none'; element.style.display = (element.style.display == 'none') ? '' : 'none';
} }
function coverage_toggle_all () { function coverage_toggle_all() {
var divs = document.querySelectorAll('div.coverage-container'); var divs = document.querySelectorAll('div.coverage-container');
var i = divs.length; var i = divs.length;
while (i--) { while (i--) {

View file

@ -561,7 +561,7 @@ class File {
$finfo = finfo_open(FILEINFO_MIME); $finfo = finfo_open(FILEINFO_MIME);
list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd())); list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd()));
return $type; return $type;
} else if (function_exists('mime_content_type')) { } elseif (function_exists('mime_content_type')) {
return mime_content_type($this->pwd()); return mime_content_type($this->pwd());
} }
return false; return false;

View file

@ -214,7 +214,7 @@ class Sanitize {
if (is_string($options)) { if (is_string($options)) {
$options = array('connection' => $options); $options = array('connection' => $options);
} else if (!is_array($options)) { } elseif (!is_array($options)) {
$options = array(); $options = array();
} }

View file

@ -477,7 +477,7 @@ class Set {
if (empty($tokens)) { if (empty($tokens)) {
break; break;
} }
} while(1); } while (1);
$r = array(); $r = array();
@ -760,7 +760,7 @@ class Set {
* @param mixed $val1 First value * @param mixed $val1 First value
* @param mixed $val2 Second value * @param mixed $val2 Second value
* @return array Returns the key => value pairs that are not common in $val1 and $val2 * @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 * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::diff
*/ */
public static function diff($val1, $val2 = null) { public static function diff($val1, $val2 = null) {
@ -963,7 +963,7 @@ class Set {
$out = array(); $out = array();
if ($object instanceof SimpleXMLElement) { if ($object instanceof SimpleXMLElement) {
return Xml::toArray($object); return Xml::toArray($object);
} else if (is_object($object)) { } elseif (is_object($object)) {
$keys = get_object_vars($object); $keys = get_object_vars($object);
if (isset($keys['_name_'])) { if (isset($keys['_name_'])) {
$identity = $keys['_name_']; $identity = $keys['_name_'];
@ -1205,7 +1205,7 @@ class Set {
} }
$return = $input; $return = $input;
foreach($keys as $key) { foreach ($keys as $key) {
if (!isset($return[$key])) { if (!isset($return[$key])) {
return null; return null;
} }

View file

@ -81,7 +81,7 @@ class String {
if (function_exists('hphp_get_thread_id')) { if (function_exists('hphp_get_thread_id')) {
$pid = 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(); $pid = zend_thread_id();
} else { } else {
$pid = getmypid(); $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('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/s', $tag[2])) {
if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) { if (preg_match('/<[\w]+[^>]*>/s', $tag[0])) {
array_unshift($openTags, $tag[2]); 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); $pos = array_search($closeTag[1], $openTags);
if ($pos !== false) { if ($pos !== false) {
array_splice($openTags, $pos, 1); array_splice($openTags, $pos, 1);

View file

@ -2523,7 +2523,7 @@ class FormHelper extends AppHelper {
$data['10'] = __d('cake', 'October'); $data['10'] = __d('cake', 'October');
$data['11'] = __d('cake', 'November'); $data['11'] = __d('cake', 'November');
$data['12'] = __d('cake', 'December'); $data['12'] = __d('cake', 'December');
} else if (is_array($options['monthNames'])) { } elseif (is_array($options['monthNames'])) {
$data = $options['monthNames']; $data = $options['monthNames'];
} else { } else {
for ($m = 1; $m <= 12; $m++) { for ($m = 1; $m <= 12; $m++) {

View file

@ -1136,7 +1136,7 @@ class HtmlHelper extends AppHelper {
} }
if (isset($itemOptions['even']) && $index % 2 == 0) { if (isset($itemOptions['even']) && $index % 2 == 0) {
$itemOptions['class'] = $itemOptions['even']; $itemOptions['class'] = $itemOptions['even'];
} else if (isset($itemOptions['odd']) && $index % 2 != 0) { } elseif (isset($itemOptions['odd']) && $index % 2 != 0) {
$itemOptions['class'] = $itemOptions['odd']; $itemOptions['class'] = $itemOptions['odd'];
} }
$out .= sprintf($this->_tags['li'], $this->_parseAttributes($itemOptions, array('even', 'odd'), ' ', ''), $item); $out .= sprintf($this->_tags['li'], $this->_parseAttributes($itemOptions, array('even', 'odd'), ' ', ''), $item);

View file

@ -220,7 +220,7 @@ class RssHelper extends AppHelper {
} }
$elements[$key] = implode('', $categories); $elements[$key] = implode('', $categories);
continue 2; continue 2;
} else if (is_array($val) && isset($val['domain'])) { } elseif (is_array($val) && isset($val['domain'])) {
$attrib['domain'] = $val['domain']; $attrib['domain'] = $val['domain'];
} }
break; break;

View file

@ -41,7 +41,7 @@ App::uses('CakeRequest', 'Network');
* *
* {{{ * {{{
* class ExampleController extends AppController { * class ExampleController extends AppController {
* public function download () { * public function download() {
* $this->viewClass = 'Media'; * $this->viewClass = 'Media';
* $params = array( * $params = array(
* 'id' => 'example.zip', * 'id' => 'example.zip',
@ -142,7 +142,7 @@ class MediaView extends View {
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) { if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) {
$contentType = 'application/octetstream'; $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'; $contentType = 'application/force-download';
} }

View file

@ -952,7 +952,7 @@ class View extends Object {
return $name; return $name;
} }
$name = trim($name, DS); $name = trim($name, DS);
} else if ($name[0] === '.') { } elseif ($name[0] === '.') {
$name = substr($name, 3); $name = substr($name, 3);
} elseif (!$plugin) { } elseif (!$plugin) {
$name = $this->viewPath . DS . $subDir . $name; $name = $this->viewPath . DS . $subDir . $name;