src/Listener/DeferredListenerAggregate.php
public function setListener($event, $service, $method = null, $priority = 0)
    {
        if (is_int($method)) {
            $priority = $method;
            $method = null;
        }

        $name = uniqid();

        $this->listenerSpecs[$name] = [
            'event' => $event,
            'service' => $service,
            'method' => $method,
            'priority' => $priority,
            'instance' => null,
        ];

        return $this;
    }
public function setListener($event, $service, $method = null, $priority = 0)
    {
        if (is_int($method)) {
            $priority = $method;
            $method = null;
        }

        $name = uniqid();

        $this->listenerSpecs[$name] = [
            'event' => $event,
            'service' => $service,
            'method' => $method,
            'priority' => $priority,
            'instance' => null,
        ];

        return $this;
    }
Adds a listener specification.

@param string     $event
@param string     $service
@param null|string|int $method
@param int  $priority

@return self
@since 0.25