public function addEventListener($eventName, array $listeners)
    {
        if (!array_key_exists($eventName, $this->options['events'])) {
            $this->options['events'][$eventName] = [
                'object' =>BaseEvent::class,
                'listeners' => $listeners,
            ];
        }

        $this->options['events'][$eventName]['listeners'] = array_merge(
            $this->options['events'][$eventName]['listeners'],
            $listeners
        );

        return $this;
    }
public function addEventListener($eventName, array $listeners)
    {
        if (!array_key_exists($eventName, $this->options['events'])) {
            $this->options['events'][$eventName] = [
                'object' =>BaseEvent::class,
                'listeners' => $listeners,
            ];
        }

        $this->options['events'][$eventName]['listeners'] = array_merge(
            $this->options['events'][$eventName]['listeners'],
            $listeners
        );

        return $this;
    }
public function addEventListener ( $ eventName , array $ listeners ) { if ( ! array_key_exists ( $ eventName , $ this -> options [ 'events' ] ) ) { $ this -> options [ 'events' ] [ $ eventName ] = [ 'object' => BaseEvent :: class , 'listeners' => $ listeners , ] ; } $ this -> options [ 'events' ] [ $ eventName ] [ 'listeners' ] = array_merge ( $ this -> options [ 'events' ] [ $ eventName ] [ 'listeners' ] , $ listeners ) ; return $ this ; }
dynamically add new listener or listeners for given event name
listeners are added at end of the list

@param string $eventName
@param array $listeners
@return $this
dynamically add new listener or listeners for given event name listeners are added at end of the list