public function mergeEventListeners($eventListeners)
    {
        if ($eventListeners instanceof EventManagerInterface) {
            $eventListeners = $eventListeners->getEventListeners();
        }

        foreach (((array) $eventListeners) as $eventName => $listeners) {
            $queue = [];
            if (isset($this->eventListeners[$eventName])) {
                $innerListeners = clone $this->eventListeners[$eventName];
                $innerListeners->setExtractFlags(ListenerQueue::EXTR_DATA);
                foreach ($innerListeners as $callback) {
                    $queue[] = $callback;
                }
            }
            $listeners = clone $listeners;
            $listeners->setExtractFlags(ListenerQueue::EXTR_BOTH);
            foreach ($listeners as $listener) {
                if (!in_array($listener['data'], $queue)) {
                    $this->attach($eventName, $listener['data'], $listener['priority']);
                }
            }
        }

        return true;
    }
public function mergeEventListeners($eventListeners)
    {
        if ($eventListeners instanceof EventManagerInterface) {
            $eventListeners = $eventListeners->getEventListeners();
        }

        foreach (((array) $eventListeners) as $eventName => $listeners) {
            $queue = [];
            if (isset($this->eventListeners[$eventName])) {
                $innerListeners = clone $this->eventListeners[$eventName];
                $innerListeners->setExtractFlags(ListenerQueue::EXTR_DATA);
                foreach ($innerListeners as $callback) {
                    $queue[] = $callback;
                }
            }
            $listeners = clone $listeners;
            $listeners->setExtractFlags(ListenerQueue::EXTR_BOTH);
            foreach ($listeners as $listener) {
                if (!in_array($listener['data'], $queue)) {
                    $this->attach($eventName, $listener['data'], $listener['priority']);
                }
            }
        }

        return true;
    }
public function mergeEventListeners ( $ eventListeners ) { if ( $ eventListeners instanceof EventManagerInterface ) { $ eventListeners = $ eventListeners -> getEventListeners ( ) ; } foreach ( ( ( array ) $ eventListeners ) as $ eventName => $ listeners ) { $ queue = [ ] ; if ( isset ( $ this -> eventListeners [ $ eventName ] ) ) { $ innerListeners = clone $ this -> eventListeners [ $ eventName ] ; $ innerListeners -> setExtractFlags ( ListenerQueue :: EXTR_DATA ) ; foreach ( $ innerListeners as $ callback ) { $ queue [ ] = $ callback ; } } $ listeners = clone $ listeners ; $ listeners -> setExtractFlags ( ListenerQueue :: EXTR_BOTH ) ; foreach ( $ listeners as $ listener ) { if ( ! in_array ( $ listener [ 'data' ] , $ queue ) ) { $ this -> attach ( $ eventName , $ listener [ 'data' ] , $ listener [ 'priority' ] ) ; } } } return true ; }
Merge current events listeners with a given list.

@param ListenerQueue[]|EventManagerInterface $eventListeners event listeners by event name

@return bool true on success false on failure
Merge current events listeners with a given list .