{@inheritdoc}
Pass a asterisk (*) as event name to get the onAll listeners

@param string $event
@param string $position ('after'|'before'|'')

@throws \Ems\Core\Exceptions\UnsupportedParameterException

@return array
961257
public function getListeners($event, $position = '')
    {
        $event = $this->eventToString($event);

        if (!in_array($position, ['', 'before', 'after'], true)) {
            throw new UnsupportedParameterException('Bus only supports position "","before","after"');
        }

        if ($event != '*') {
            return $position ? $this->getAfterOrBeforeListeners($event, $position) : $this->getOnListeners($event);
        }

        if (!$position) {
            return $this->anyListeners;
        }

        if ($position == 'before') {
            return $this->beforeAnyListeners;
        }

        return $this->afterAnyListeners;

    }
625964
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event] ?? [];

        if ($event !== '*') {
            $namesWithWildcard = array_filter(array_keys($this->listeners), function ($name) {
                return $name !== '*' && strpos($name, '*') !== false;
            });
            foreach ($namesWithWildcard as $name) {
                if (StringHelper::matchWildcard('*', $name)) {
                    $listeners = array_merge($listeners, $this->listeners[$name]);
                }
            }
        }

        if (empty($listeners)) {
            return [];
        }

        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
765914
public function onParameterPreDeserialize(PreDeserializeEvent $event)
    {
        $data = $event->getData();

        if (array_key_exists('$ref', $data)) {
            $event->setType(RefParameter::class);
            return;
        }

        $data['class'] = $data['in'];

        if (array_key_exists('type', $data)) {
            $data['class'] = sprintf('%s.%s', $data['in'], $data['type']);
        }

        $event->setData($data);
    }
786417
private function getEventNameParts($event) {
        $parts = ['*'];
        $offset = 0;

        while ($offset = strpos($event, '.', $offset + 1)) {
            $parts[] = substr($event, 0, $offset) . '.*';
        }

        $parts[] = $event;

        return $parts;
    }
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;
    }
1345418
public function getListeners($event): array
    {
        $event = $this->getEventName($event);

        if (! $this->hasListener($event)) {
            return [];
        }

        if (! array_key_exists($event, $this->sortedListeners)) {
            $listeners = $this->listeners[$event];

            krsort($listeners);

            $listeners = call_user_func_array(
                'array_merge',
                $listeners
            );
            $this->sortedListeners[$event] = $listeners;

            unset($listeners);
        }

        return $this->sortedListeners[$event];
    }
554194
public function getListeners(string $event)
    {
        if (isset($this->listeners[$event])) {
            return $this->listeners[$event];
        } elseif (isset($this->classListeners[$event])) {
            return $this->classListeners[$event];
        }

        return [];
    }
872659
protected function collectListeners($event, array $args=[])
    {
        $event = $this->eventToString($event);

        $listeners = [];

        // Build args for * listeners
        array_unshift($args, $event);

        foreach ($this->root->getListeners('*', 'before') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'before') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners($event) as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        foreach ($this->root->getListeners($event, 'after') as $listener) {
            $listeners[] = $listener;
        }

        foreach ($this->root->getListeners('*', 'after') as $listener) {
            $listeners[] = function () use ($listener, $event, &$args) {
                return $this->callListener($listener, $event, $args);
            };
        }

        return $listeners;
    }
312579
public static function createInvalidArrayPosition($name, array $position)
    {
        return new self(sprintf(
            'The %s form uses position as array or you must define the "before" or "after" option (current: %s).',
            self::decorateValue($name),
            implode(', ', self::decorateValues(array_keys($position)))
        ));
    }
25606
public function getLetter($data, $position)
    {
        foreach ($this->codes as $code) {
            if ($code[$position] == $data) {
                return $code[0];
            }
        }

        return null;
    }
581312
public function deleteCharAt( $position )
	{
		$string	= "";
		for( $i = 0; $i < $this->count(); $i++ )
			if( $position != $i )
				$string .= $this->buffer[$i];
		$this->buffer = $string;
		if( $position == $this->pointer )
			$this->pointer++;
		return $this->toString();
	}
724986
public function setPosition($position)
    {
        switch ($position) {
            case Modification::POSITION_ANY:
            case Modification::POSITION_NTERM:
            case Modification::POSITION_CTERM:
            case Modification::POSITION_PROTEIN_NTERM:
            case Modification::POSITION_PROTEIN_CTERM:
                $this->position = $position;
                
                break;
            default:
                throw new \InvalidArgumentException('Postion must be any or terminus (see POSITION_XXXX)');
        }
    }
259026
protected function getPayloadFromEvent($event)
    {
        if (method_exists($event, 'broadcastWith')) {
            return array_merge(
                $event->broadcastWith(), ['socket' => data_get($event, 'socket')]
            );
        }

        $payload = [];

        foreach ((new ReflectionClass($event))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
            $payload[$property->getName()] = $this->formatProperty($property->getValue($event));
        }

        unset($payload['broadcastQueue']);

        return $payload;
    }
1152373
private function postInfo(
        string $context,
        string $position,
        Post $post,
        int $count
    ): string {
        return $post->info($this->posts->args[$context][$position])->list();
    }
441391
public function replace($position, $length, $string)
	{
		ArgumentValidator::validateUnsignedInteger($position);
		ArgumentValidator::validateUnsignedInteger($length);
		ArgumentValidator::validateScalar($string);
		if ($position >= $this->length()) {
			throw new \InvalidArgumentException('Position invalid');
		}
		if ($position + $length > $this->length()) {
			throw new \InvalidArgumentException('Length invalid');
		}
		$this->string = mb_substr($this->string, 0, $position) . (string)$string . mb_substr($this->string, $position + $length);
		return $this;
	}
1085221
public function beforeFind(Event $event)
    {
        //Inject default query handlers
        $queryParameters = Hash::merge($this->getConfig('queryParameters'), [
            'sort' => [
                'callable' => [$this, '_sortParameter'],
            ],
            'include' => [
                'callable' => [$this, '_includeParameter']
            ],
            'fields' => [
                'callable' => [$this, '_fieldSetsParameter']
            ]
        ]);

        foreach ($queryParameters as $parameter => $options) {
            if (is_callable($options)) {
                $options = [
                    'callable' => $options
                ];
            }

            if (!is_callable($options['callable'])) {
                throw new \InvalidArgumentException('Invalid callable supplied for query parameter ' . $parameter);
            }

            $options['callable']($this->_request()->getQuery($parameter), $event->getSubject(), $options);
        }
    }
93571
public function getListeners($event)
    {
        $parentListeners = [];
        $wildcards = [];

        if( is_object($event) )
        {
            $eventName = get_class($event);
            $parentListeners = $this->getParentListeners($event);
        }
        else
        {
            $eventName = $event;
            $wildcards = $this->getWildcardListeners($event);
        }

        if (!isset($this->sorted[$eventName])) {
            $this->sortListeners($eventName);
        }

        return array_merge($this->sorted[$eventName], $wildcards, $parentListeners);
    }