示例#1
0
 /**
  * Defines a point where hooks can hook
  *
  * @param string $event The hook name
  * @param array  $args  (optional) The arguments to pass along
  * @param bool   $halt  (optional) If this hook can halt
  *
  * @return array|null
  */
 protected function hookPoint($event, array $args = [], $halt = true)
 {
     if (config('codex.dev.enabled', false) === true) {
         if (array_key_exists($event, static::$hookPoints)) {
             throw CodexException::because('hook point already exists');
         }
         Arr::add(static::$hooks, $event, static::getDispatcher()->getListeners($event));
         $caller = $this->hookPointGetCaller(debug_backtrace(), 1);
         $caller = array_only($caller, ['function', 'class']);
         Arr::set(static::$hookPoints, static::getEventName($event), $caller);
     }
     return $this->fireEvent($event, $args, $halt);
 }