src/OAuthServiceRegistry.php
protected function createService($service)
    {
        if (!isset($this->config[$service])) {
            throw new \InvalidArgumentException(sprintf('OAuth configuration not defined for the "%s" service.', $service));
        }

        $referenceType = true;
        $urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface';
        if (defined(sprintf('%s::ABSOLUTE_URL', $urlGeneratorInterface))) {
            $referenceType = $urlGeneratorInterface::ABSOLUTE_URL;
        }
        $credentials = new Credentials(
            $this->config[$service]['key'],
            $this->config[$service]['secret'],
            $this->urlGenerator->generate($this->options['callback_route'], array(
                'service' => strtolower($service)
            ), $referenceType)
        );

        $scope = isset($this->config[$service]['scope']) ? $this->config[$service]['scope'] : array();
        $uri = isset($this->config[$service]['uri']) ? new Uri($this->config[$service]['uri']) : null;

        if (isset($this->config[$service]['class'])) {
            $this->oauthServiceFactory->registerService($service, $this->config[$service]['class']);
            unset($this->config[$service]['class']);
        }

        return $this->oauthServiceFactory->createService(
            $service,
            $credentials,
            $this->oauthStorage,
            $scope,
            $uri
        );
    }
protected function createService($service)
    {
        if (!isset($this->config[$service])) {
            throw new \InvalidArgumentException(sprintf('OAuth configuration not defined for the "%s" service.', $service));
        }

        $referenceType = true;
        $urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface';
        if (defined(sprintf('%s::ABSOLUTE_URL', $urlGeneratorInterface))) {
            $referenceType = $urlGeneratorInterface::ABSOLUTE_URL;
        }
        $credentials = new Credentials(
            $this->config[$service]['key'],
            $this->config[$service]['secret'],
            $this->urlGenerator->generate($this->options['callback_route'], array(
                'service' => strtolower($service)
            ), $referenceType)
        );

        $scope = isset($this->config[$service]['scope']) ? $this->config[$service]['scope'] : array();
        $uri = isset($this->config[$service]['uri']) ? new Uri($this->config[$service]['uri']) : null;

        if (isset($this->config[$service]['class'])) {
            $this->oauthServiceFactory->registerService($service, $this->config[$service]['class']);
            unset($this->config[$service]['class']);
        }

        return $this->oauthServiceFactory->createService(
            $service,
            $credentials,
            $this->oauthStorage,
            $scope,
            $uri
        );
    }
protected function createService ( $ service ) { if ( ! isset ( $ this -> config [ $ service ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'OAuth configuration not defined for the "%s" service.' , $ service ) ) ; } $ referenceType = true ; $ urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface' ; if ( defined ( sprintf ( '%s::ABSOLUTE_URL' , $ urlGeneratorInterface ) ) ) { $ referenceType = $ urlGeneratorInterface :: ABSOLUTE_URL ; } $ credentials = new Credentials ( $ this -> config [ $ service ] [ 'key' ] , $ this -> config [ $ service ] [ 'secret' ] , $ this -> urlGenerator -> generate ( $ this -> options [ 'callback_route' ] , array ( 'service' => strtolower ( $ service ) ) , $ referenceType ) ) ; $ scope = isset ( $ this -> config [ $ service ] [ 'scope' ] ) ? $ this -> config [ $ service ] [ 'scope' ] : array ( ) ; $ uri = isset ( $ this -> config [ $ service ] [ 'uri' ] ) ? new Uri ( $ this -> config [ $ service ] [ 'uri' ] ) : null ; if ( isset ( $ this -> config [ $ service ] [ 'class' ] ) ) { $ this -> oauthServiceFactory -> registerService ( $ service , $ this -> config [ $ service ] [ 'class' ] ) ; unset ( $ this -> config [ $ service ] [ 'class' ] ) ; } return $ this -> oauthServiceFactory -> createService ( $ service , $ credentials , $ this -> oauthStorage , $ scope , $ uri ) ; }
Instantiate a service by name.

@param string $service

@return ServiceInterface
Instantiate a service by name .