namespaces[$identifier])) { if (in_array($identifier, $this->removedNamespaces, true)) { unset($this->removedNamespaces[array_search($identifier, $this->removedNamespaces, true)]); } $this->namespaces[$identifier] = new SessionNamespace(); } return $this->namespaces[$identifier]; } /** * Return whether the given session namespace exists * * @param string $identifier The namespace's identifier to check * * @return bool */ public function hasNamespace($identifier) { return isset($this->namespaces[$identifier]); } /** * Remove the given session namespace * * @param string $identifier The identifier of the namespace to remove */ public function removeNamespace($identifier) { unset($this->namespaces[$identifier]); $this->removedNamespaces[] = $identifier; } /** * Return whether the session has changed * * @return bool */ public function hasChanged() { return parent::hasChanged() || false === empty($this->namespaces) || false === empty($this->removedNamespaces); } /** * Clear all values and namespaces from the session cache */ public function clear() { parent::clear(); $this->namespaces = array(); $this->removedNamespaces = array(); } }