vendor/knpuniversity/oauth2-client-bundle/src/DependencyInjection/ProviderFactory.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * OAuth2 Client Bundle
  4.  * Copyright (c) KnpUniversity <http://knpuniversity.com/>
  5.  *
  6.  * For the full copyright and license information, please view the LICENSE
  7.  * file that was distributed with this source code.
  8.  */
  9. namespace KnpU\OAuth2ClientBundle\DependencyInjection;
  10. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  11. /**
  12.  * Used to create the individual Provider objects in the service container.
  13.  *
  14.  * You won't need to use this directly.
  15.  */
  16. class ProviderFactory
  17. {
  18.     private UrlGeneratorInterface $generator;
  19.     /**
  20.      * ProviderFactory constructor.
  21.      */
  22.     public function __construct(UrlGeneratorInterface $generator)
  23.     {
  24.         $this->generator $generator;
  25.     }
  26.     /**
  27.      * Creates a provider of the given class.
  28.      *
  29.      * @param string $class
  30.      */
  31.     public function createProvider($class, array $optionsstring $redirectUri null, array $redirectParams = [], array $collaborators = [])
  32.     {
  33.         if (null !== $redirectUri) {
  34.             $redirectUri $this->generator
  35.                 ->generate($redirectUri$redirectParamsUrlGeneratorInterface::ABSOLUTE_URL);
  36.             $options['redirectUri'] = $redirectUri;
  37.         }
  38.         return new $class($options$collaborators);
  39.     }
  40. }