Mmanos\Social\Social::service PHP Method

service() public method

Return an instance of the requested service.
public service ( string $provider, string $url = null, array $scope = null ) : OAuth\Common\Service\AbstractService
$provider string
$url string
$scope array
return OAuth\Common\Service\AbstractService
    public function service($provider, $url = null, $scope = null)
    {
        $info = Config::get('laravel-social::providers.' . strtolower($provider));
        if (empty($info) || !is_array($info)) {
            throw new Exception('Missing configuration details for Social service: ' . $provider);
        }
        $client_id = array_get($info, 'client_id');
        $client_secret = array_get($info, 'client_secret');
        $scope = is_null($scope) ? array_get($info, 'scope') : $scope;
        if (empty($client_id) || empty($client_secret)) {
            throw new Exception('Missing client id/secret for Social service: ' . $provider);
        }
        return $this->factory->createService(ucfirst($provider), new Credentials($client_id, $client_secret, $url ?: URL::current()), $this->storage, $scope);
    }