示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
文件: Log.php 项目: Grummfy/Central
 /**
  * Log a message with a type.
  *
  * @access  public
  * @param   string  $message    The log message.
  * @param   int     $type       Type of message (please, see the class
  *                              constants).
  * @param   array   $extra      Extra dynamic informations.
  * @return  void
  */
 public function log($message, $type = self::DEBUG, $extra = array())
 {
     $filters = $this->getFilters();
     if (null !== $filters && !($type & $filters)) {
         return;
     }
     $handle = $this->_stack[] = array_merge(array(self::STACK_TIMESTAMP => microtime(true), self::STACK_MESSAGE => $message, self::STACK_PRIORITY => $type, self::STACK_MEMORY => memory_get_usage(), self::STACK_MEMORY_PEAK => memory_get_peak_usage()), $this->getAddedStackInformations(), $extra);
     \Hoa\Core\Event::notify('hoa://Event/Log/' . self::$_currentId, $this, new \Hoa\Core\Event\Bucket(array('log' => $handle)));
     if ($type & self::DEBUG) {
         if (null === $this->_backtrace) {
             $this->_backtrace = new Backtrace();
         }
         $this->_backtrace->debug();
     }
     return;
 }
示例#4
0
文件: Dal.php 项目: Grummfy/Central
 /**
  * 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;
 }
示例#5
0
 /**
  * Send the exception on hoa://Event/Exception.
  *
  * @return  void
  */
 public function send()
 {
     Core\Event::notify('hoa://Event/Exception', $this, new Core\Event\Bucket($this));
     return;
 }
示例#6
0
文件: Window.php 项目: alexpw/Console
 /**
  * Set the event channel.
  * We need to declare(ticks = 1) in the main script to ensure that the event
  * is fired. Also, we need the pcntl_signal() function enabled.
  *
  * @access  public
  * @return  void
  */
 public function __construct()
 {
     \Hoa\Core\Event::register('hoa://Event/Console/Window:resize', $this);
     return;
 }