vendor/gos/web-socket-bundle/src/GosWebSocketBundle.php line 23

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Gos\Bundle\WebSocketBundle;
  3. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\DataCollectorCompilerPass;
  4. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\PeriodicCompilerPass;
  5. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\PusherCompilerPass;
  6. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\RegisterTwigGlobalsCompilerPass;
  7. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\RegisterWebsocketRouterResourcesCompilerPass;
  8. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\RpcCompilerPass;
  9. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\ServerCompilerPass;
  10. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\ServerPushHandlerCompilerPass;
  11. use Gos\Bundle\WebSocketBundle\DependencyInjection\CompilerPass\TopicCompilerPass;
  12. use Gos\Bundle\WebSocketBundle\DependencyInjection\Factory\Authentication\SessionAuthenticationProviderFactory;
  13. use Gos\Bundle\WebSocketBundle\DependencyInjection\GosWebSocketExtension;
  14. use Symfony\Component\DependencyInjection\ContainerBuilder;
  15. use Symfony\Component\EventDispatcher\DependencyInjection\AddEventAliasesPass;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. /**
  18.  * @author Johann Saunier <johann_27@hotmail.fr>
  19.  */
  20. class GosWebSocketBundle extends Bundle
  21. {
  22.     public function build(ContainerBuilder $container): void
  23.     {
  24.         $container
  25.             ->addCompilerPass(new AddEventAliasesPass(GosWebSocketEvents::ALIASES))
  26.             ->addCompilerPass(new ServerCompilerPass())
  27.             ->addCompilerPass(new RpcCompilerPass())
  28.             ->addCompilerPass(new TopicCompilerPass())
  29.             ->addCompilerPass(new PeriodicCompilerPass())
  30.             ->addCompilerPass(new PusherCompilerPass(true))
  31.             ->addCompilerPass(new ServerPushHandlerCompilerPass(true))
  32.             ->addCompilerPass(new DataCollectorCompilerPass(true))
  33.             ->addCompilerPass(new RegisterTwigGlobalsCompilerPass())
  34.             ->addCompilerPass(new RegisterWebsocketRouterResourcesCompilerPass())
  35.         ;
  36.         /** @var GosWebSocketExtension $extension */
  37.         $extension $container->getExtension('gos_web_socket');
  38.         $extension->addAuthenticationProviderFactory(new SessionAuthenticationProviderFactory());
  39.     }
  40.     public function getPath(): string
  41.     {
  42.         return \dirname(__DIR__);
  43.     }
  44. }