vendor/friendsofsymfony/oauth-server-bundle/FOSOAuthServerBundle.php line 24

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSOAuthServerBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace FOS\OAuthServerBundle;
  11. use FOS\OAuthServerBundle\DependencyInjection\Compiler\TokenStorageCompilerPass;
  12. use FOS\OAuthServerBundle\DependencyInjection\Compiler\RequestStackCompilerPass;
  13. use FOS\OAuthServerBundle\DependencyInjection\FOSOAuthServerExtension;
  14. use FOS\OAuthServerBundle\DependencyInjection\Security\Factory\OAuthFactory;
  15. use FOS\OAuthServerBundle\DependencyInjection\Compiler\GrantExtensionsCompilerPass;
  16. use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
  17. use Symfony\Component\DependencyInjection\ContainerBuilder;
  18. use Symfony\Component\HttpKernel\Bundle\Bundle;
  19. use Symfony\Component\HttpKernel\Kernel;
  20. class FOSOAuthServerBundle extends Bundle
  21. {
  22.     /**
  23.      * @example '2.1.0'
  24.      * @var string
  25.      */
  26.     private $kernelVersion;
  27.     public function __construct()
  28.     {
  29.         $this->kernelVersion Kernel::VERSION;
  30.         $this->extension = new FOSOAuthServerExtension();
  31.     }
  32.     public function build(ContainerBuilder $container)
  33.     {
  34.         parent::build($container);
  35.         if (version_compare($this->kernelVersion'2.1''>=')) {
  36.             /** @var SecurityExtension $extension */
  37.             $extension $container->getExtension('security');
  38.             $extension->addSecurityListenerFactory(new OAuthFactory());
  39.         }
  40.         $container->addCompilerPass(new GrantExtensionsCompilerPass());
  41.         $container->addCompilerPass(new TokenStorageCompilerPass());
  42.         $container->addCompilerPass(new RequestStackCompilerPass());
  43.     }
  44. }