/** * Destroy the namespace. * The namespace will be locked and considered as expired (only the event * will be fired, not the exception). * * @return void */ public function delete() { $namespace = $this->getNamespace(); $channel = static::EVENT_CHANNEL . $namespace; $this->hasExpired(false); unset($_SESSION[static::TOP_NAMESPACE][$namespace]); Core\Event::unregister($channel); Core\Event::unregister($channel . ':expired'); static::$_lock[$namespace] = true; return; }
/** * Close the current stream. * * @return void */ public final function close() { $streamName = $this->getStreamName(); $name = md5($streamName); if (!isset(self::$_register[$name])) { return; } Core\Event::notify('hoa://Event/Stream/' . $streamName . ':close-before', $this, new Core\Event\Bucket()); if (false === $this->_close()) { return; } unset(self::$_register[$name]); $this->_bucket[self::HANDLER] = null; unset($this->_on); Core\Event::unregister('hoa://Event/Stream/' . $streamName); Core\Event::unregister('hoa://Event/Stream/' . $streamName . ':close-before'); return; }
/** * Close connection to the database. * * @return bool */ public function close() { $id = $this->getId(); $event = 'hoa://Event/Database/' . $id; $this->_layer = null; self::$_id = null; unset(self::$_instance[$id]); Core\Event::notify($event . ':closed', $this, new Core\Event\Bucket(['id' => $id])); Core\Event::unregister($event . ':opened'); Core\Event::unregister($event . ':closed'); return true; }