Moving Router::__filter() to Set::filter()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4867 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-04-17 07:00:26 +00:00
parent 9a865176aa
commit e5b0f2e3fa
2 changed files with 25 additions and 25 deletions

View file

@ -104,6 +104,23 @@ class Set extends Object {
}
return $r;
}
/**
* Filters empty elements out of a route array, excluding '0'.
*
* @return mixed
*/
function filter($var, $isArray = false) {
if (is_array($var) && (!empty($var) || $isArray)) {
$set = new Set();
return array_filter($var, array(&$set, 'filter'));
} else {
if ($var === 0 || $var === '0' || !empty($var)) {
return true;
} else {
return false;
}
}
}
/**
* Pushes the differences in $array2 onto the end of $array
*