/** * Remove an attribute. * * @param string An attribute name. * @param string An attribute namespace. * * @return mixed An attribute value, if the attribute was removed, * otherwise null. * * @author Sean Kerr <*****@*****.**> * @since 0.9.0 */ public function &removeAttribute($name, $ns = null) { if ($ns === null) { $ns = $this->defaultNamespace; } $retval = null; if (isset($this->attributes[$ns])) { if (isset($this->attributes[$ns][$name]) || array_key_exists($name, $this->attributes[$ns])) { $retval =& $this->attributes[$ns][$name]; unset($this->attributes[$ns][$name]); } else { try { $retval =& AgaviArrayPathDefinition::unsetValue($name, $this->attributes[$ns]); } catch (InvalidArgumentException $e) { } } } return $retval; }
/** * Removes file information for given file. * * @param string A file name * * @return mixed The old AgaviUploadedFile instance or array of elements. * * @author David Zülke <*****@*****.**> * @author Dominik del Bondio <*****@*****.**> * @since 0.11.0 */ public function &removeFile($name) { if (isset($this->files[$name]) || array_key_exists($name, $this->files)) { $retval =& $this->files[$name]; unset($this->files[$name]); return $retval; } try { return AgaviArrayPathDefinition::unsetValue($name, $this->files); } catch (InvalidArgumentException $e) { } }
/** * Remove a parameter. * * @param string A parameter name. * * @return string A parameter value, if the parameter was removed, * otherwise null. * * @author Sean Kerr <*****@*****.**> * @since 0.9.0 */ public function &removeParameter($name) { if (isset($this->parameters[$name]) || array_key_exists($name, $this->parameters)) { $retval =& $this->parameters[$name]; unset($this->parameters[$name]); return $retval; } $retval = null; try { $retval =& AgaviArrayPathDefinition::unsetValue($name, $this->parameters); } catch (InvalidArgumentException $e) { } return $retval; }