mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
coding standards and simplification of else cases as well as some minor fixes
This commit is contained in:
parent
58149f2315
commit
7cb19b97db
31 changed files with 142 additions and 169 deletions
|
@ -123,8 +123,7 @@ class BakeShell extends AppShell {
|
|||
$this->Test->execute();
|
||||
break;
|
||||
case 'Q':
|
||||
exit(0);
|
||||
break;
|
||||
return $this->_stop();
|
||||
default:
|
||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
||||
}
|
||||
|
|
|
@ -345,7 +345,6 @@ class ConsoleShell extends AppShell {
|
|||
default:
|
||||
$this->out(__d('cake_console', "Invalid command"));
|
||||
$this->out();
|
||||
break;
|
||||
}
|
||||
$command = '';
|
||||
}
|
||||
|
|
|
@ -84,8 +84,7 @@ class I18nShell extends AppShell {
|
|||
$this->out($this->OptionParser->help());
|
||||
break;
|
||||
case 'q':
|
||||
exit(0);
|
||||
break;
|
||||
return $this->_stop();
|
||||
default:
|
||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
||||
}
|
||||
|
|
|
@ -107,12 +107,11 @@ class SchemaShell extends AppShell {
|
|||
if ($File->exists()) {
|
||||
$this->out($File->read());
|
||||
return $this->_stop();
|
||||
} else {
|
||||
}
|
||||
$file = $this->Schema->path . DS . $this->params['file'];
|
||||
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
|
||||
return $this->_stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read database and Write schema object
|
||||
|
@ -185,11 +184,10 @@ class SchemaShell extends AppShell {
|
|||
if ($this->Schema->write($content)) {
|
||||
$this->out(__d('cake_console', 'Schema file: %s generated', $content['file']));
|
||||
return $this->_stop();
|
||||
} else {
|
||||
}
|
||||
$this->err(__d('cake_console', 'Schema file: %s generated'));
|
||||
return $this->_stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump Schema object to sql file
|
||||
|
|
|
@ -65,9 +65,8 @@ class PluginTask extends AppShell {
|
|||
$this->out(__d('cake_console', 'Plugin: %s already exists, no action taken', $plugin));
|
||||
$this->out(__d('cake_console', 'Path: %s', $pluginPath));
|
||||
return false;
|
||||
} else {
|
||||
$this->_interactive($plugin);
|
||||
}
|
||||
$this->_interactive($plugin);
|
||||
} else {
|
||||
return $this->_interactive();
|
||||
}
|
||||
|
|
|
@ -368,12 +368,9 @@ class ProjectTask extends AppShell {
|
|||
if ($File->write($result)) {
|
||||
Configure::write('Routing.prefixes', array($name));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -250,9 +250,8 @@ class Scaffold {
|
|||
$success
|
||||
);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
return $this->controller->afterScaffoldSaveError($action);
|
||||
}
|
||||
return $this->controller->afterScaffoldSaveError($action);
|
||||
} else {
|
||||
if ($this->_validSession) {
|
||||
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
||||
|
@ -309,14 +308,13 @@ class Scaffold {
|
|||
if ($this->ScaffoldModel->delete()) {
|
||||
$message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
}
|
||||
$message = __d('cake',
|
||||
'There was an error deleting the %1$s with id: %2$s',
|
||||
Inflector::humanize($this->modelClass),
|
||||
$id
|
||||
);
|
||||
return $this->_sendMessage($message);
|
||||
}
|
||||
} elseif ($this->controller->scaffoldError('delete') === false) {
|
||||
return $this->_scaffoldError();
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ class ErrorHandler {
|
|||
'path' => Debugger::trimPath($file)
|
||||
);
|
||||
return Debugger::getInstance()->outputError($data);
|
||||
} else {
|
||||
}
|
||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||
if (!empty($errorConfig['trace'])) {
|
||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||
|
@ -206,7 +206,6 @@ class ErrorHandler {
|
|||
}
|
||||
return CakeLog::write($log, $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an error page when some fatal error happens.
|
||||
|
|
|
@ -762,7 +762,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
array($Model->escapeField() => $id)
|
||||
);
|
||||
return $Model->delete($id);
|
||||
} else {
|
||||
}
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
if ($node[$right] == $edge) {
|
||||
$edge = $edge - 2;
|
||||
|
@ -773,7 +773,6 @@ class TreeBehavior extends ModelBehavior {
|
|||
array('callbacks' => false, 'validate' => false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current tree is valid.
|
||||
|
|
|
@ -755,15 +755,13 @@ class Postgres extends DboSource {
|
|||
break;
|
||||
default:
|
||||
$resultRow[$table][$column] = $row[$index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $resultRow;
|
||||
} else {
|
||||
}
|
||||
$this->_result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates between PHP boolean values and PostgreSQL boolean values
|
||||
|
@ -788,7 +786,6 @@ class Postgres extends DboSource {
|
|||
break;
|
||||
default:
|
||||
$result = (bool)$data;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($quote) {
|
||||
|
|
|
@ -50,7 +50,6 @@ class CakeTestModel extends Model {
|
|||
break;
|
||||
default:
|
||||
$queryData['order'] = array($this->alias . '.' . $this->primaryKey => 'ASC');
|
||||
break;
|
||||
}
|
||||
return $queryData;
|
||||
}
|
||||
|
|
|
@ -97,14 +97,13 @@ class CakeTime {
|
|||
*
|
||||
* @param string $name Variable name
|
||||
* @param mixes $value Variable value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($name, $value) {
|
||||
switch ($name) {
|
||||
case 'niceFormat':
|
||||
self::${$name} = $value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -334,7 +334,6 @@ class Inflector {
|
|||
}
|
||||
}
|
||||
self::${$var}['rules'] = $rules + self::${$var}['rules'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,6 @@ class Validation {
|
|||
break;
|
||||
default:
|
||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for Validation::comparison()');
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -665,15 +665,13 @@ class Helper extends Object {
|
|||
break;
|
||||
default:
|
||||
$name = 'data[' . implode('][', $this->entity()) . ']';
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
$options[$key] = $name;
|
||||
return $options;
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -729,9 +727,8 @@ class Helper extends Object {
|
|||
if (is_array($options)) {
|
||||
$options[$key] = $result;
|
||||
return $options;
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -920,7 +917,7 @@ class Helper extends Object {
|
|||
do {
|
||||
$oldstring = $this->_cleaned;
|
||||
$this->_cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->_cleaned);
|
||||
} while ($oldstring != $this->_cleaned);
|
||||
} while ($oldstring !== $this->_cleaned);
|
||||
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,6 @@ class FormHelper extends AppHelper {
|
|||
));
|
||||
default:
|
||||
$htmlAttributes['method'] = 'post';
|
||||
break;
|
||||
}
|
||||
$this->requestType = strtolower($options['type']);
|
||||
|
||||
|
|
|
@ -165,7 +165,6 @@ abstract class JsBaseEngineHelper extends AppHelper {
|
|||
if ($quoteString) {
|
||||
$val = '"' . $val . '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
|
|
@ -648,7 +648,6 @@ class PaginatorHelper extends AppHelper {
|
|||
'{:page}', '{:pages}', '{:current}', '{:count}', '{:start}', '{:end}', '{:model}'
|
||||
);
|
||||
$out = str_replace($newKeys, array_values($map), $out);
|
||||
break;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,6 @@ class TimeHelper extends AppHelper {
|
|||
break;
|
||||
default:
|
||||
$this->{$name} = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue