vendor\knpuniversity\oauth2-client-bundle\src\DependencyInjection\ProviderFactory.php line 40

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.      * @param string $redirectUri
  31.      *
  32.      * @return mixed
  33.      */
  34.     public function createProvider($class, array $optionsstring $redirectUri null, array $redirectParams = [], array $collaborators = [])
  35.     {
  36.         if (null !== $redirectUri) {
  37.             $redirectUri $this->generator
  38.                 ->generate($redirectUri$redirectParamsUrlGeneratorInterface::ABSOLUTE_URL);
  39.             $options['redirectUri'] = $redirectUri;
  40.         }
  41.         return new $class($options$collaborators);
  42.     }
  43. }