src/AbstractContainerMediator.php
public function addServiceListener(string $eventName, array $listener, $priority = 0): ContainerMediatorInterface
    {
        $this->checkEventName($eventName);
        $this->checkAllowedServiceListener($listener);
        $priority = $this->getActualPriority($eventName, $priority);
        if (\array_key_exists($eventName, $this->serviceListeners)
            && \array_key_exists($priority, $this->serviceListeners[$eventName])
            && \in_array($listener, $this->serviceListeners[$eventName][$priority], \true)
        ) {
            return $this;
        }
        $this->serviceListeners[$eventName][$priority][] = $listener;
        return $this;
    }
public function addServiceListener(string $eventName, array $listener, $priority = 0): ContainerMediatorInterface
    {
        $this->checkEventName($eventName);
        $this->checkAllowedServiceListener($listener);
        $priority = $this->getActualPriority($eventName, $priority);
        if (\array_key_exists($eventName, $this->serviceListeners)
            && \array_key_exists($priority, $this->serviceListeners[$eventName])
            && \in_array($listener, $this->serviceListeners[$eventName][$priority], \true)
        ) {
            return $this;
        }
        $this->serviceListeners[$eventName][$priority][] = $listener;
        return $this;
    }
public function addServiceListener ( string $ eventName , array $ listener , $ priority = 0 ) : ContainerMediatorInterface { $ this -> checkEventName ( $ eventName ) ; $ this -> checkAllowedServiceListener ( $ listener ) ; $ priority = $ this -> getActualPriority ( $ eventName , $ priority ) ; if ( \ array_key_exists ( $ eventName , $ this -> serviceListeners ) && \ array_key_exists ( $ priority , $ this -> serviceListeners [ $ eventName ] ) && \ in_array ( $ listener , $ this -> serviceListeners [ $ eventName ] [ $ priority ] , \ true ) ) { return $ this ; } $ this -> serviceListeners [ $ eventName ] [ $ priority ] [ ] = $ listener ; return $ this ; }
Add a service as an event listener.

@param string     $eventName Name of the event the listener is being added for.
@param array      $listener  Listener to be added. ['containerID', 'method']
@param int|string $priority  Priority level for the added listener.

@return ContainerMediatorInterface Fluent interface.
@throws \DomainException
@throws \InvalidArgumentException
Add a service as an event listener .