vendor/gos/web-socket-bundle/src/Pusher/PusherRegistry.php line 5

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Gos\Bundle\WebSocketBundle\Pusher;
  3. trigger_deprecation('gos/web-socket-bundle', '3.1', 'The "%s" class is deprecated and will be removed in 4.0, use the symfony/messenger component instead.', PusherRegistry::class);
  4. /**
  5. * @deprecated to be removed in 4.0, use the symfony/messenger component instead
  6. */
  7. final class PusherRegistry
  8. {
  9. /**
  10. * @var PusherInterface[]
  11. */
  12. private array $pushers = [];
  13. public function addPusher(PusherInterface $pusher): void
  14. {
  15. $this->pushers[$pusher->getName()] = $pusher;
  16. }
  17. /**
  18. * @throws \InvalidArgumentException if the requested pusher was not registered
  19. */
  20. public function getPusher(string $name): PusherInterface
  21. {
  22. if (!$this->hasPusher($name)) {
  23. throw new \InvalidArgumentException(sprintf('A pusher named "%s" has not been registered.', $name));
  24. }
  25. return $this->pushers[$name];
  26. }
  27. public function getPushers(): array
  28. {
  29. return $this->pushers;
  30. }
  31. public function hasPusher(string $name): bool
  32. {
  33. return isset($this->pushers[$name]);
  34. }
  35. }