mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-20 05:37:51 +09:00
Updates to vendors etc
This commit is contained in:
@@ -30,25 +30,21 @@ use Symfony\Contracts\Service\ResetInterface;
|
||||
*/
|
||||
class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterface
|
||||
{
|
||||
protected ?LoggerInterface $logger;
|
||||
protected Stopwatch $stopwatch;
|
||||
|
||||
/**
|
||||
* @var \SplObjectStorage<WrappedListener, array{string, string}>|null
|
||||
*/
|
||||
private ?\SplObjectStorage $callStack = null;
|
||||
private EventDispatcherInterface $dispatcher;
|
||||
private array $wrappedListeners = [];
|
||||
private array $orphanedEvents = [];
|
||||
private ?RequestStack $requestStack;
|
||||
private string $currentRequestHash = '';
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, ?LoggerInterface $logger = null, ?RequestStack $requestStack = null)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->stopwatch = $stopwatch;
|
||||
$this->logger = $logger;
|
||||
$this->requestStack = $requestStack;
|
||||
public function __construct(
|
||||
private EventDispatcherInterface $dispatcher,
|
||||
protected Stopwatch $stopwatch,
|
||||
protected ?LoggerInterface $logger = null,
|
||||
private ?RequestStack $requestStack = null,
|
||||
protected readonly ?\Closure $disabled = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function addListener(string $eventName, callable|array $listener, int $priority = 0): void
|
||||
@@ -108,6 +104,9 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa
|
||||
|
||||
public function dispatch(object $event, ?string $eventName = null): object
|
||||
{
|
||||
if ($this->disabled?->__invoke()) {
|
||||
return $this->dispatcher->dispatch($event, $eventName);
|
||||
}
|
||||
$eventName ??= $event::class;
|
||||
|
||||
$this->callStack ??= new \SplObjectStorage();
|
||||
@@ -115,7 +114,7 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa
|
||||
$currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : '';
|
||||
|
||||
if (null !== $this->logger && $event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
|
||||
$this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
|
||||
$this->logger->debug(\sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));
|
||||
}
|
||||
|
||||
$this->preProcess($eventName);
|
||||
|
||||
Reference in New Issue
Block a user