Skip to content

Commit

Permalink
Removing ife() from AclShell. Refs #6562
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 21, 2009
1 parent 0657afc commit 1ee9771
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cake/console/libs/acl.php
Expand Up @@ -225,7 +225,7 @@ function getPath() {
$this->_checkArgs(2, 'getPath');
$this->checkNodeType();
extract($this->__dataVars());
$id = ife(is_numeric($this->args[1]), intval($this->args[1]), $this->args[1]);
$id = is_numeric($this->args[1]) ? intval($this->args[1]) : $this->args[1];
$nodes = $this->Acl->{$class}->getPath($id);
if (empty($nodes)) {
$this->error(sprintf(__("Supplied Node '%s' not found", true), $this->args[1]), __("No tree returned.", true));
Expand Down Expand Up @@ -304,7 +304,7 @@ function view() {
$this->checkNodeType();
extract($this->__dataVars());
if (isset($this->args[1]) && !is_null($this->args[1])) {
$key = ife(is_numeric($this->args[1]), $secondary_id, 'alias');
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
$conditions = array($class . '.' . $key => $this->args[1]);
} else {
$conditions = null;
Expand Down Expand Up @@ -425,8 +425,8 @@ function help() {
foreach ($commands as $cmd) {
$this->out("{$cmd}\n\n");
}
} elseif (isset($commands[low($this->args[0])])) {
$this->out($commands[low($this->args[0])] . "\n\n");
} elseif (isset($commands[strtolower($this->args[0])])) {
$this->out($commands[strtolower($this->args[0])] . "\n\n");
} else {
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0]));
}
Expand Down Expand Up @@ -457,7 +457,7 @@ function nodeExists() {
return false;
}
extract($this->__dataVars($this->args[0]));
$key = (ife(is_numeric($this->args[1]), $secondary_id, 'alias'));
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
$conditions = array($class . '.' . $key => $this->args[1]);
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
if (empty($possibility)) {
Expand All @@ -472,8 +472,8 @@ function nodeExists() {
* @access private
*/
function __getParams() {
$aro = ife(is_numeric($this->args[0]), intval($this->args[0]), $this->args[0]);
$aco = ife(is_numeric($this->args[1]), intval($this->args[1]), $this->args[1]);
$aro = is_numeric($this->args[0]) ? intval($this->args[0]) : $this->args[0];
$aco = is_numeric($this->args[1]) ? intval($this->args[1]) : $this->args[1];

if (is_string($aro) && preg_match('/^([\w]+)\.(.*)$/', $aro, $matches)) {
$aro = array(
Expand Down Expand Up @@ -512,7 +512,7 @@ function __dataVars($type = null) {
}
$vars = array();
$class = ucwords($type);
$vars['secondary_id'] = ife(strtolower($class) == 'aro', 'foreign_key', 'object_id');
$vars['secondary_id'] = strtolower($class) == 'aro' ? 'foreign_key' : 'object_id';
$vars['data_name'] = $type;
$vars['table_name'] = $type . 's';
$vars['class'] = $class;
Expand Down

0 comments on commit 1ee9771

Please sign in to comment.