Register an entity event with the dispatcher.

@param string   $event
@param \Closure $callback

@return void
160198
public function registerEvent($event, $callback)
    {
        $name = $this->entityMap->getClass();

        $this->dispatcher->listen("analogue.{$event}.{$name}", $callback);
    }
242589
protected static function registerModelEvent($event, $callback)
    {
        $event = self::makeModelEventName($event);

        event()->listen($event, $callback);
    }
620458
public function table($table, Closure $callback)
    {
        $blueprint = $this->createBlueprint($table);
        if ($callback) {
            $callback($blueprint);
        }
    }
675423
public function trigger($event, \Closure $callback = null)
    {
        $results = [];

        if (!$event instanceof EventInterface) {
            $event = new Event($event);
        }

        if ($listeners = $this->getListeners($event->getName())) {
            foreach ($listeners as $listener) {
                $result = call_user_func($listener, $event);
                if ($result instanceof EventInterface) {
                    // Save result
                    $results[] = clone $result;

                    // Was the queue halted early ?
                    if ($result->isQueueHaltedEarly()) {
                        return $this;
                    }

                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }

                    // Was the queue halted ?
                    if ($result->isQueueHalted()) {
                        return $this;
                    }
                } else {
                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }
                }
            }
        }
        if ($results) {
            return $results;
        }

        return false;
    }
125844
public function table($table, Closure $callback)
    {
        $this->build($this->createBlueprint($table, $callback));
    }
804147
public static function listen(string $event, callable $callback) {
		if (!isset(self::$events[$event])) {
			self::$events[$event] = [];
		}
		self::$events[$event][] = $callback;
	}
1117863
public function registerCallback( $event, $callback ) {

		if ( !is_string( $event ) ) {
			throw new InvalidArgumentException( "Event is not a string" );
		}

		if ( !is_callable( $callback ) ) {
			throw new RuntimeException( "Invoked object is not a valid callback or Closure" );
		}

		$this->addToCollection( $event, new GenericCallbackEventListener( $callback ) );
	}
1274155
public function registerEvent($event, $object, $fn){
		$this->actions[$event][] = new \OWeb\manage\events\Event($object, $fn);
	}
1129905
protected function callListener($callable, Event $event)
    {
        if ($callable instanceof Closure || is_array($callable)) {
            call_user_func_array($callable, array_filter([$event, $event->getSubject(), $event->getData()]));
        } elseif (is_object($callable)) {
            $callable->{$event->getType()}($event, $event->getSubject(), $event->getData());
        }
    }
1082599
public function bind($event, callable $handler)
    {
        if (in_array($event, [self::EVENT_INIT, self::EVENT_FORK, self::EVENT_START])) {
            throw new InvalidArgumentException('You can not bind a callback for this event');
        }

        parent::bind($event, $handler);
    }
993420
public function detach($event, $callback){
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            $listeners = $this->removeListener($listeners, $eventObject, $callback);
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
734069
public function register($event, $listener, \Closure $callback)
    {
        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }

        if ($listener) {
            $this->events[$event][$listener] = $callback;
        } else {
            $this->events[$event][] = $callback;
            $keys = array_keys($this->events[$event]);
            $listener = array_pop($keys);
        }

        return $listener;
    }
649324
public function detach($event, $callback)
    {
        if (null !== $callback) {
            $oid = $this->hashCallable($callback);
            if (isset($this->callable_map[$event][$oid])) {
                $callback = $this->callable_map[$event][$oid];
                unset($this->callable_map[$event][$oid]);
            }
        } else {
            unset($this->callable_map[$event]);
        }
        return parent::detach($event, $callback);
    }
886816
public function dispatchUntil(ActionEvent $event, callable $callback): void
    {
        foreach ($this->getListeners($event) as $listenerHandler) {
            $listener = $listenerHandler->getActionEventListener();
            $listener($event);

            if ($event->propagationIsStopped()) {
                return;
            }
            if ($callback($event) === true) {
                return;
            }
        }
    }
308003
protected function resolvingCallback(Closure $callback)
    {
        $abstract = $this->getFunctionHint($callback);

        if ($abstract) {
            $this->resolvingCallbacks[$abstract][] = $callback;
        } else {
            $this->globalResolvingCallbacks[] = $callback;
        }
    }
1168835
protected final void registerCustomEventCallback(
            final CrawlEvent event,
            final PatternMatchingCallback callback) {
        Validate.notNull(event, "The event cannot be null.");
        Validate.notNull(callback, "The callback cannot be null.");

        callbackManager.addCustomEventCallback(event, callback);
    }
930434
public function on($event, \Closure $callback): void
    {
        // check if event is a single string and parse it to array single item
        if (!Any::isArray($event)) {
            $event = [$event];
        }
        
        foreach ($event as $item) {
            $this->events[$item][] = $callback;
        }
    }