This commit is contained in:
2026-03-21 12:30:52 -04:00
parent b25ab2d651
commit f0f26be2c0
2 changed files with 12 additions and 0 deletions

View File

@@ -13,4 +13,6 @@ interface DispatcherAwareInterface extends BaseDispatcherAwareInterface, AwareIn
public function eventDispatcher(): BaseDispatcher;
public function hasEventDispatcher(): bool;
public function useEventDispatcher(BaseDispatcher $dispatcher): void;
public function withEventDispatcher(BaseDispatcher $dispatcher): static;
public function withoutEventDispatcher(): static;
}

View File

@@ -28,6 +28,16 @@ trait DispatcherAwareTrait
return $this->has(self::DISPATCHER);
}
final public function withEventDispatcher(BaseDispatcher $dispatcher): static
{
return $this->with(self::DISPATCHER, $dispatcher);
}
final public function withoutEventDispatcher(): static
{
return $this->without(self::DISPATCHER);
}
abstract public function get(string $key): mixed;
abstract public function has(string $key): mixed;
abstract protected function set(string $key, mixed $value): mixed;