mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-04 18:42:40 +00:00
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:
parent
9a865176aa
commit
e5b0f2e3fa
2 changed files with 25 additions and 25 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue