Add listener

@access public
@param  string $event name
@param  array $listener
190132
public function add_listener($event) {
		if (strpos('::', $event) === false) {
			$classname = get_called_class();
			$method = $event;
		} else {
			list($classname, $method) = explode('::', $event);
		}
		$event_name = strtolower(str_replace('\\', '_', $classname . '_' . $method));

		$dispatcher = \Skeleton\Event\Dispatcher::get();
		$dispatcher->add_listener($event_name, [ '\\Event\\' . $classname, $method ]);
	}
1108104
public function on($event, callable $listener)
    {
        if (is_object($event) || strpos($event, '\\')) { // looks like a class
            throw new UnsupportedParameterException('Only string based events are supported');
        }

        if (!isset($this->listeners[$event])) {
            $this->listeners[$event] = [];
        }
        $this->listeners[$event][] = $listener;

        return $this;
    }
639465
public function addListener(string $eventName, $listener) : void
    {
        $this->dispatcher->addListener($eventName, $listener);
    }
1232790
protected function callListenerBindings(Listener $listener, Event $event)
    {
        $binding = $listener->determineEventBinding($event);

        if ($listener->hasBinding($binding)) {
            foreach ($listener->getBindings($binding) as $callback) {
                $resource = $event->getResource();

                call_user_func($callback, $resource, $resource->getPath());
            }
        }

        // If a listener has a binding for anything we'll also spin through
        // them and call each of them.
        if ($listener->hasBinding('*')) {
            foreach ($listener->getBindings('*') as $callback) {
                $resource = $event->getResource();

                call_user_func($callback, $event, $resource, $resource->getPath());
            }
        }
    }
1273295
public function AttachObserver($listener)
	{
		if ($listener) {
			$this->_observers[] =& $listener;
			if ($this->_masterAdapter) $this->_masterAdapter->AttachObserver($listener);
		}
		
	}
824673
public function listener(Event $event)
    {
        error_log(
            $event->context->get(0)->getRequestTarget() . PHP_EOL,
            3,
            RUNTIME_PATH . '/logs/example.log'
        );
    }
1111178
public function listen($events, $listener, $priority = 0)
    {
        //$priority = sprintf('p:%s', str_pad($priority, 6, '0', STR_PAD_LEFT));

        foreach ((array) $events as $event) {
            $this->listeners[$event][$priority][] = $this->makeListener($listener);
        }
    }
350416
public function registerListener( $event, EventListener $listener ) {

		if ( !is_string( $event ) ) {
			throw new InvalidArgumentException( "Event is not a string" );
		}

		$this->addToCollection( $event, $listener );
	}
314101
public function addListener($listener, $type = null)
    {
        if (!$type) {
            $type = basename(substr($listener, strrpos($listener, '\\') + 1), 'Listener');
            $type = lcfirst(rtrim($type, '0123456789'));
        }

        $this->_listeners[$type][$listener] = 1;

        return $this;
    }
65189
public function once($event, $listener, int $priority = Priority::NORMAL)
    {
        $this->addListener($event, $listener, $priority, true);
    }
1087634
protected function storeListener($event, callable $listener)
    {
        if (!isset($this->listeners[$event])) {
            $this->listeners[$event] = [];
        }
        $this->listeners[$event][] = $listener;

        return $this;
    }
1172525
public function addListenerForEvent($eventClassName, $listener)
    {
        if (FALSE === array_key_exists($eventClassName, $this->eventMap))
        {
            $this->eventMap[$eventClassName] = [];
        }
        $this->eventMap[$eventClassName][] = $listener;
    }
707614
function addListener(id, event, listener) {
    if (!hasListeners(event)) {
      context._events[event] = {};
    }
    
    context._events[event][id] = listener;

    return id;
  }
1070379
public function addListener($name, $listener, $priority = 0)
    {
        if (! isset($this->listeners[$name])) $this->listeners[$name] = [];
        $this->listeners[$name][$priority][] = $listener;
    }
185438
public function listen($eventName, $callback)
    {
        if (is_array($eventName)) {
            foreach ($eventName as $evnt) {
                $this["dispatcher"]->addListener($evnt, $callback);
            }
        } else {
            $this["dispatcher"]->addListener($eventName, $callback);
        }
    }
878298
public function addListeners(array $events_config)
    {
        foreach ($events_config as $name => $listeners) {
            if (false === array_key_exists('listeners', $listeners)) {
                $this->application->warning("None listener found for `$name` event.");
                continue;
            }

            $listeners['listeners'] = (array) $listeners['listeners'];
            foreach ($listeners['listeners'] as $listener) {
                $this->addListener($name, $listener);
            }
        }
    }
444963
protected function registerListener($event, $listener, $priority)
    {
        if (!is_callable($listener)) {
            throw new DispatcherException(sprintf('Invalid event listener. Only callables or ListenerInterface instances can be registered, got "%s"', gettype($listener)));
        }

        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }

        if ($priority === null) {
            $this->events[$event][] = $listener;

            return;
        }

        array_splice($this->events[$event], (int) $priority, 0, [$listener]);
    }