/**
  * This method must be called to make class "PC" available
  * @param Connector|null $connector
  * @param Handler|null $handler
  * @throws \Exception
  * @return Connector
  */
 public static function register(Connector $connector = null, Handler $handler = null)
 {
     if (static::$connector) {
         throw new \Exception('Helper already registered');
     }
     self::$handler = $handler;
     self::$connector = $connector ?: Connector::getInstance();
     self::$isActive = self::$connector->isActiveClient();
     return self::$connector;
 }
Example #2
0
 /**
  * Handle debug data
  * @param mixed $data
  * @param string|null $tags Tags separated by dot, e.g. "low.db.billing"
  * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
  */
 public function debug($data, $tags = null, $ignoreTraceCalls = 0)
 {
     if ($this->connector->isActiveClient()) {
         $this->connector->getDebugDispatcher()->dispatchDebug($data, $tags, is_numeric($ignoreTraceCalls) ? $ignoreTraceCalls + 1 : $ignoreTraceCalls);
     }
 }
 /**
  * Check if dispatcher is active to send messages
  * @return bool
  */
 public function isActive()
 {
     return $this->connector->isActiveClient();
 }
Example #4
0
 /**
  * Handle debug data
  * @param mixed $data
  * @param string|null $tags Tags separated by dot, e.g. "low.db.billing"
  * @param int $skipTraceCalls Number of proxy methods between original "debug method call" and this method call
  */
 public function debug($data, $tags = null, $skipTraceCalls = 0)
 {
     if ($this->connector->isActiveClient()) {
         $this->connector->getDebugDispatcher()->dispatchDebug($data, $tags, $skipTraceCalls + 1);
     }
 }