Get the priority of the given listener. 得到指定监听器的优先级
@param   mixed $listener The listener.
@param   mixed $default The default value to return if the listener doesn't exist.
@return  mixed  The listener priority if it exists, null otherwise.
516280
public function getPriority($listener, $default = null)
    {
        if ($this->store->contains($listener)) {
            // @see self::add(). attach as: `[priority, counter value]`
            return $this->store[$listener][0];
        }

        return $default;
    }
485428
public static function get($index = null, $default = null)
	{
		return (func_num_args() === 0) ? $_GET : \Arr::get($_GET, $index, $default);
	}
413272
public function removeListener($event, $listener)
    {
        // listenersCallback
        if( $event instanceof \Closure ) {
            foreach( $this->listenersCallback as $key => $value ) {
                // does the event and listener match?
                if( $value[0] === $event && $value[1] === $listener ) {
                    unset( $this->listenersCallback[$key] );
                }
            }
        // standard listeners
        } else {

            // listeners
            if (isset($this->listeners[$event])) {
                if (false !== ($key = array_search($listener, $this->listeners[$event]))) {
                    unset($this->listeners[$event][$key]);
                }
                if( !$this->listeners[$event] ) {
                    unset( $this->listeners[$event] );
                }
            }
            // listeners once
            if (isset($this->listenersOnce[$event])) {
                if (false !== ($key = array_search($listener, $this->listenersOnce[$event]))) {
                    unset($this->listenersOnce[$event][$key]);
                }
                if( !$this->listenersOnce[$event] ) {
                    unset( $this->listenersOnce[$event] );
                }
            }
        }
        return $this;
    }
443111
public function prepare($listener)
    {
        if (! $this->requirements->check()) {
            return $listener->preparationNotCompleted();
        }

        $this->installer->migrate();

        return $listener->preparationCompleted();
    }
378534
public static function get($key=null,$default=null){
    return $key ? (filter_input(INPUT_GET,$key) ?: (is_callable($default)?call_user_func($default):$default)) : $_GET;
  }
378058
protected function findListenerSubscription($listener)
    {
        foreach ($this->subscriptions as $subscription) {
            if ($this->subscriptions->getInfo()[0] === $listener) {
                return $subscription;
            }
        }

        return null;
    }
759023
public function addEventListener($eventName, $listener, $priority = EventPriority::NORMAL) {
        if (!isset($this->_listeners[$eventName][$priority])) {
            $this->_listeners->extendDeepValue(array($priority=>array()), $eventName);
        }
        $this->_listeners[$eventName][$priority][] = $listener;
    }
441851
protected function call($key, $args, $default = null)
    {
        $handlers = (array) $this->listeners[$key];

        foreach ($handlers as $handler) {
            if (!is_callable($handler)) {
                continue;
            }

            $res = call_user_func_array($handler, $args);

            if (!empty($res)) {
                return $res;
            }
        }

        return $default;
    }
1159049
public function createClassListener($listener)
    {
        return function() use ($listener)
        {
            $callable = $this->createClassCallable($listener);

            // We will make a callable of the listener instance and a method that should
            // be called on that instance, then we will pass in the arguments that we
            // received in this method into this listener class instance's methods.
            $data = func_get_args();

            return call_user_func_array($callable, $data);
        };
    }
1059495
public function listen($events, $listener, $priority = 0)
    {
        if ($priority === 0) {
            $this->events->on($events, $listener);
            return;
        }

        if ($priority > 5) {
            $this->events->onBefore($events, $listener);
            return;
        }

        $this->events->onAfter($events, $listener);

    }
1342966
public function listen( Listener $listener ) {

		if ( isset( $this->listeners[ $listener->get_tag() ] ) ) {
			return false;
		}

		$this->listeners[ $listener->get_tag() ] = $listener;

		return true;
	}
897217
static private function getListener($listener)
    {
        $listenerClassName = Ioc::resolveClassName($listener);
    	if (!isset(self::$_elInstances[$listenerClassName])) {
    		if (!($listener instanceof EventListenerInterface)) {
    			$listener = Ioc::createObject($listener);
    		}
    		self::$_elInstances[$listenerClassName] = $listener;
    	}
    	
    	return self::$_elInstances[$listenerClassName];
    }
558774
public function get($id, $default = null)
    {
        $query = $this->model->newQuery();

        $this->callBeforeListeners('get', [$query]);

        if (!$model = $this->performGet($query, $id)) {
            return $default;
        }

        $this->callAfterListeners('get', [$model]);

        /** @var Identifiable $model */
        return $model;
    }
1109672
private function ensureListener($listener)
    {
        if ($listener instanceof ListenerInterface) {
            return $listener;
        }

        if (is_callable($listener)) {
            return CallbackListener::fromCallable($listener);
        }

        throw new \BadMethodCallException('Fetched listener neither implements ListenerInterface nor is a callable');
    }
871821
public function add($listener, $priority)
    {
        if (!$this->storage->contains($listener)) {
            // Compute the internal priority as an array.
            $priority = [$priority, $this->counter--];

            $this->storage->attach($listener, $priority);
            $this->queue->insert($listener, $priority);
        }

        return $this;
    }
147518
public function getListenerInfo($listener)
    {
        $info = array();

        if(is_callable($listener))
        {
            if (get_class('Closure') && $listener instanceof Closure)
            {
                $info += array(
                    'type'   => 'Closure',
                    'pretty' => 'closure'
                );
            }

            if (is_string($listener))
            {
                try
                {
                    $r = new ReflectionFunction($listener);
                    $file = $r->getFileName();
                    $line = $r->getStartLine();
                }
                catch (ReflectionException $e)
                {
                    $file = null;
                    $line = null;
                }

                $info += array
                (
                    'type'  => 'Function',
                    'function' => $listener,
                    'file'  => $file,
                    'line'  => $line,
                    'pretty' => $listener,
                );
            }

            if (is_array($listener) || (is_object($listener)))
            {
                if (!is_array($listener)) {
                    $listener = array($listener, '__invoke');
                }

                $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];

                try
                {
                    $r = new ReflectionMethod($class, $listener[1]);
                    $file = $r->getFileName();
                    $line = $r->getStartLine();
                }
                catch (ReflectionException $e)
                {
                    $file = null;
                    $line = null;
                }

                $info += array
                (
                    'type'   => 'Method',
                    'class'  => $class,
                    'method' => $listener[1],
                    'file'   => $file,
                    'line'   => $line,
                    'pretty' => $class.'::'.$listener[1],
                );
            }
        }

        return $info;
    }
646192
protected function _callListener(callable $listener, Event $event)
    {
        $data = $event->getData();

        return $listener($event, ...array_values($data));
    }