src/EventsManager.php
public function attach(string $eventName, $handler, int $priority = 100): void
    {
        if (is_object($handler) == false && is_callable($handler) == false) {
            throw new InvalidArgumentException(
                sprintf('Event handler must be either an object or a callable %s given.', gettype($handler))
            );
        }

        $priorityQueue = $this->fetchQueue($eventName);
        $priorityQueue->insert($handler, $priority);
    }
public function attach(string $eventName, $handler, int $priority = 100): void
    {
        if (is_object($handler) == false && is_callable($handler) == false) {
            throw new InvalidArgumentException(
                sprintf('Event handler must be either an object or a callable %s given.', gettype($handler))
            );
        }

        $priorityQueue = $this->fetchQueue($eventName);
        $priorityQueue->insert($handler, $priority);
    }
Attach a listener to the events manager.

@param  string          $eventName
@param  object|callable $handler
@param  int             $priority
@return void

@throws InvalidArgumentException