mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
coding standards and else block simplification
This commit is contained in:
parent
f27d4a8e42
commit
f389435bae
9 changed files with 37 additions and 44 deletions
|
@ -327,7 +327,7 @@ class SchemaShell extends AppShell {
|
|||
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
|
||||
$this->out(array_keys($drop));
|
||||
|
||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
|
||||
if ($this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y') {
|
||||
$this->out(__d('cake_console', 'Dropping table(s).'));
|
||||
$this->_run($drop, 'drop', $Schema);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ class SchemaShell extends AppShell {
|
|||
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
|
||||
$this->out(array_keys($create));
|
||||
|
||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
|
||||
if ($this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y') {
|
||||
$this->out(__d('cake_console', 'Creating table(s).'));
|
||||
$this->_run($create, 'create', $Schema);
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ class SchemaShell extends AppShell {
|
|||
|
||||
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
|
||||
$this->out(array_map('trim', $contents));
|
||||
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
|
||||
if ($this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y') {
|
||||
$this->out();
|
||||
$this->out(__d('cake_console', 'Updating Database...'));
|
||||
$this->_run($contents, 'update', $Schema);
|
||||
|
|
|
@ -657,7 +657,7 @@ class ModelTask extends BakeTask {
|
|||
$prompt = "{$model->name} {$type} {$assoc['alias']}?";
|
||||
$response = $this->in($prompt, array('y', 'n'), 'y');
|
||||
|
||||
if ('n' == strtolower($response)) {
|
||||
if (strtolower($response) === 'n') {
|
||||
unset($associations[$type][$i]);
|
||||
} elseif ($type === 'hasMany') {
|
||||
unset($associations['hasOne'][$i]);
|
||||
|
|
|
@ -335,9 +335,8 @@ class ViewTask extends BakeTask {
|
|||
if (strtolower($looksGood) === 'y') {
|
||||
$this->bake($action, ' ');
|
||||
return $this->_stop();
|
||||
} else {
|
||||
$this->out(__d('cake_console', 'Bake Aborted.'));
|
||||
}
|
||||
$this->out(__d('cake_console', 'Bake Aborted.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -252,12 +252,11 @@ class Scaffold {
|
|||
return $this->_sendMessage($message);
|
||||
}
|
||||
return $this->controller->afterScaffoldSaveError($action);
|
||||
} else {
|
||||
}
|
||||
if ($this->_validSession) {
|
||||
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($request->data)) {
|
||||
if ($this->ScaffoldModel->id) {
|
||||
|
|
|
@ -1255,11 +1255,11 @@ class Model extends Object implements CakeEventListener {
|
|||
isset($data['meridian']) &&
|
||||
!empty($data['hour']) &&
|
||||
$data['hour'] != 12 &&
|
||||
'pm' == $data['meridian']
|
||||
$data['meridian'] === 'pm'
|
||||
) {
|
||||
$data['hour'] = $data['hour'] + 12;
|
||||
}
|
||||
if (isset($data['hour']) && isset($data['meridian']) && $data['hour'] == 12 && 'am' == $data['meridian']) {
|
||||
if (isset($data['hour']) && isset($data['meridian']) && $data['hour'] == 12 && $data['meridian'] === 'am') {
|
||||
$data['hour'] = '00';
|
||||
}
|
||||
if ($type === 'time') {
|
||||
|
|
|
@ -54,7 +54,6 @@ class Hash {
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -731,9 +731,8 @@ class FormHelper extends AppHelper {
|
|||
$tag = is_string($options['wrap']) ? $options['wrap'] : 'div';
|
||||
unset($options['wrap']);
|
||||
return $this->Html->tag($tag, $error, $options);
|
||||
} else {
|
||||
return $error;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,9 +289,8 @@ class HtmlHelper extends AppHelper {
|
|||
|
||||
if (empty($options['block'])) {
|
||||
return $out;
|
||||
} else {
|
||||
$this->_View->append($options['block'], $out);
|
||||
}
|
||||
$this->_View->append($options['block'], $out);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,9 +450,8 @@ class HtmlHelper extends AppHelper {
|
|||
|
||||
if (empty($options['block'])) {
|
||||
return $out;
|
||||
} else {
|
||||
$this->_View->append($options['block'], $out);
|
||||
}
|
||||
$this->_View->append($options['block'], $out);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -674,9 +672,8 @@ class HtmlHelper extends AppHelper {
|
|||
}
|
||||
}
|
||||
return implode($separator, $out);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -478,7 +478,7 @@ if (!function_exists('clearCache')) {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
$cache = array(
|
||||
CACHE . $type . DS . '*' . $params . $ext,
|
||||
CACHE . $type . DS . '*' . $params . '_*' . $ext
|
||||
|
@ -501,7 +501,7 @@ if (!function_exists('clearCache')) {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} elseif (is_array($params)) {
|
||||
foreach ($params as $file) {
|
||||
clearCache($file, $type, $ext);
|
||||
|
|
Loading…
Reference in a new issue