protected function parseCallback($dispatcher, $callbacks, $eventName, $arguments, $listener)
    {
        if (!(\is_array($callbacks) || \is_callable($callbacks))) {
            return;
        }

        // If only one callback given, ensure the loop below handles it correctly.
        if (\is_array($callbacks) && (2 === \count($callbacks)) && !\is_array($callbacks[0])) {
            $callbacks = [$callbacks];
        }
        foreach ((array) $callbacks as $callback) {
            if ($this->isCallbackBlacklisted($callback, $listener)) {
                continue;
            }

            $dispatcher->addListener(
                $eventName,
                new $listener($callback, $arguments)
            );
        }
    }