Skip to content

Commit

Permalink
converting if($foo == true) to if($foo)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Sep 14, 2012
1 parent 22a2e1b commit 5cc03ca
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 31 deletions.
14 changes: 7 additions & 7 deletions lib/Cake/Console/Command/ConsoleShell.php
Expand Up @@ -182,7 +182,7 @@ public function main($command = null) {
$this->out(" - {$model}");
}
break;
case (preg_match("/^(\w+) bind (\w+) (\w+)/", $command, $tmp) == true):
case preg_match("/^(\w+) bind (\w+) (\w+)/", $command, $tmp):
foreach ($tmp as $data) {
$data = strip_tags($data);
$data = str_replace($this->badCommandChars, "", $data);
Expand All @@ -200,7 +200,7 @@ public function main($command = null) {
$this->out(__d('cake_console', "Please verify you are using valid models and association types"));
}
break;
case (preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp) == true):
case preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp):
foreach ($tmp as $data) {
$data = strip_tags($data);
$data = str_replace($this->badCommandChars, "", $data);
Expand Down Expand Up @@ -298,7 +298,7 @@ public function main($command = null) {
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
}
break;
case (preg_match("/^(\w+) columns/", $command, $tmp) == true):
case preg_match("/^(\w+) columns/", $command, $tmp):
$modelToCheck = strip_tags(str_replace($this->badCommandChars, "", $tmp[1]));

if ($this->_isValidModel($modelToCheck)) {
Expand All @@ -315,22 +315,22 @@ public function main($command = null) {
$this->out(__d('cake_console', "Please verify that you selected a valid model"));
}
break;
case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
case preg_match("/^routes\s+reload/i", $command, $tmp):
if (!$this->_loadRoutes()) {
$this->err(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
break;
}
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count(Router::$routes)));
break;
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
case preg_match("/^routes\s+show/i", $command, $tmp):
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
break;
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
case preg_match("/^route\s+(\(.*\))$/i", $command, $tmp):
if ($url = eval('return array' . $tmp[1] . ';')) {
$this->out(Router::url($url));
}
break;
case (preg_match("/^route\s+(.*)/i", $command, $tmp) == true):
case preg_match("/^route\s+(.*)/i", $command, $tmp):
$this->out(var_export(Router::parse($tmp[1]), true));
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/ControllerTask.php
Expand Up @@ -395,7 +395,7 @@ public function listAll($useDbConfig = null) {
}
$this->__tables = $this->Model->getAllTables($useDbConfig);

if ($this->interactive == true) {
if ($this->interactive) {
$this->out(__d('cake_console', 'Possible Controllers based on your current database:'));
$this->hr();
$this->_controllerNames = array();
Expand Down
6 changes: 1 addition & 5 deletions lib/Cake/Console/Command/Task/DbConfigTask.php
Expand Up @@ -277,11 +277,7 @@ public function bake($configs) {
$info['port'] = null;
}

if ($info['persistent'] === false) {
$info['persistent'] = 'false';
} else {
$info['persistent'] = ($info['persistent'] == true) ? 'true' : 'false';
}
$info['persistent'] = var_export((bool)$info['persistent'], true);

$oldConfigs[] = array(
'name' => $configName,
Expand Down
10 changes: 4 additions & 6 deletions lib/Cake/Console/Command/Task/ModelTask.php
Expand Up @@ -472,16 +472,14 @@ public function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
}

if ($choice != $defaultChoice) {
$validate[$validatorName] = $choice;
if (is_numeric($choice) && isset($this->_validations[$choice])) {
$validate[$validatorName] = $this->_validations[$choice];
} else {
$validate[$validatorName] = $choice;
}
}
if ($this->interactive == true && $choice != $defaultChoice) {
$anotherValidator = 'n';
if ($this->interactive && $choice != $defaultChoice) {
$anotherValidator = $this->in(__d('cake_console', 'Would you like to add another validation rule?'), array('y', 'n'), 'n');
} else {
$anotherValidator = 'n';
}
}
return $validate;
Expand Down Expand Up @@ -583,7 +581,7 @@ public function findHasOneAndMany(Model $model, $associations) {

$pattern = '/_' . preg_quote($model->table, '/') . '|' . preg_quote($model->table, '/') . '_/';
$possibleJoinTable = preg_match($pattern, $otherTable);
if ($possibleJoinTable == true) {
if ($possibleJoinTable) {
continue;
}
foreach ($modelFieldsTemp as $fieldName => $field) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/CakeSocket.php
Expand Up @@ -130,7 +130,7 @@ public function connect() {
$scheme = 'ssl://';
}

if ($this->config['persistent'] == true) {
if ($this->config['persistent']) {
$this->connection = @pfsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
} else {
$this->connection = @fsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Routing/Router.php
Expand Up @@ -425,7 +425,7 @@ public static function connectNamed($named, $options = array()) {
$options = array_merge(array('default' => false, 'reset' => false, 'greedy' => true), $options);
}

if ($options['reset'] == true || self::$_namedConfig['rules'] === false) {
if ($options['reset'] || self::$_namedConfig['rules'] === false) {
self::$_namedConfig['rules'] = array();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Network/CakeRequestTest.php
Expand Up @@ -962,7 +962,7 @@ public function testAddDetector() {
* @return void
*/
public function detectCallback($request) {
return $request->return == true;
return (bool)$request->return;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/CacheHelper.php
Expand Up @@ -312,7 +312,7 @@ protected function _writeFile($content, $timestamp, $useCallbacks = false) {
Router::setRequestInfo($controller->request);
$this->request = $request;';

if ($useCallbacks == true) {
if ($useCallbacks) {
$file .= '
$controller->constructClasses();
$controller->startupProcess();';
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -1286,7 +1286,7 @@ public function checkbox($fieldName, $options = array()) {
'value' => ($options['hiddenField'] !== true ? $options['hiddenField'] : '0'),
'secure' => false
);
if (isset($options['disabled']) && $options['disabled'] == true) {
if (isset($options['disabled']) && $options['disabled']) {
$hiddenOptions['disabled'] = 'disabled';
}
$output = $this->hidden($fieldName, $hiddenOptions);
Expand Down Expand Up @@ -1865,7 +1865,7 @@ public function select($fieldName, $options = array(), $attributes = array()) {
if (!empty($tag) || isset($template)) {
$hasOptions = (count($options) > 0 || $showEmpty);
if (
(!isset($secure) || $secure == true) &&
(!isset($secure) || $secure) &&
empty($attributes['disabled']) &&
$hasOptions
) {
Expand Down
7 changes: 1 addition & 6 deletions lib/Cake/View/Helper/PaginatorHelper.php
Expand Up @@ -526,12 +526,7 @@ public function hasPage($model = null, $page = 1) {
*/
protected function _hasPage($model, $page) {
$params = $this->params($model);
if (!empty($params)) {
if ($params["{$page}Page"] == true) {
return true;
}
}
return false;
return !empty($params) && $params[$page . 'Page'];
}

/**
Expand Down

0 comments on commit 5cc03ca

Please sign in to comment.