Fixing implementation of Set::remove() for instance and static calling

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4523 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-02-15 20:39:43 +00:00
parent a633a7392a
commit 770446905a

View file

@ -286,9 +286,8 @@ class Set extends Object {
* @param mixed $path A dot-separated string. * @param mixed $path A dot-separated string.
* @return array * @return array
*/ */
function remove(&$list, $path, $data = null) { function remove($list, $path = null) {
if (empty($data) && is_a($this, 'Set')) { if (empty($path) && is_a($this, 'Set')) {
$data = $path;
$path = $list; $path = $list;
$list = $this->get(); $list = $this->get();
} }
@ -310,7 +309,13 @@ class Set extends Object {
$_list =& $_list[$key]; $_list =& $_list[$key];
} }
} }
return $list;
if (is_a($this, 'Set')) {
$this->value = $list;
return $this;
} else {
return $list;
}
} }
/** /**
* Checks if a particular path is set in an array * Checks if a particular path is set in an array