src/Listener/DeferredListenerAggregate.php
public function setListeners(array $specs)
    {
        foreach ($specs as $spec) {
            if (!isset($spec['event']) || !isset($spec['service'])) {
                throw new \DomainException('Listener specification must be an array with the keys "event" and "service".');
            }
            $method = isset($spec['method']) ? $spec['method'] : null;
            $priority = isset($spec['priority']) ? $spec['priority'] : 0;

            $this->setListener($spec['event'], $spec['service'], $method, $priority);
        }

        return $this;
    }
public function setListeners(array $specs)
    {
        foreach ($specs as $spec) {
            if (!isset($spec['event']) || !isset($spec['service'])) {
                throw new \DomainException('Listener specification must be an array with the keys "event" and "service".');
            }
            $method = isset($spec['method']) ? $spec['method'] : null;
            $priority = isset($spec['priority']) ? $spec['priority'] : 0;

            $this->setListener($spec['event'], $spec['service'], $method, $priority);
        }

        return $this;
    }
Adds multiple listener specifications.

<b>$specs</b> must be an array of arrays in the following format:
<pre>
[
[
'event' => <eventName>,
'service' => <serviceNameOrFQCN>,
{ 'method' => <callbackMethodName>, }
{ 'priority' => <priority> }
],
...
]
</pre>

@param array $specs

@see setListener
@return self
@throws \DomainException if a specification array does not contain the keys 'event' or 'service'.
@since 0.25