From 20e2b510916bfe82c4d19b9913902cbd51ba898a Mon Sep 17 00:00:00 2001 From: DraperStudio Date: Tue, 12 Apr 2016 18:44:05 +0200 Subject: [PATCH] Properly set OAuth1 config, Add use statements --- src/Helpers/ConfigRetriever.php | 3 ++- src/OAuth1/AbstractProvider.php | 18 ++++++++++++++++-- src/OAuth1/Server.php | 6 +++++- src/OAuth1/User.php | 4 +++- src/OAuth2/AbstractProvider.php | 3 ++- src/OAuth2/User.php | 4 +++- 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/Helpers/ConfigRetriever.php b/src/Helpers/ConfigRetriever.php index a5c67f3..a0148bf 100644 --- a/src/Helpers/ConfigRetriever.php +++ b/src/Helpers/ConfigRetriever.php @@ -5,8 +5,9 @@ use SocialiteProviders\Manager\Config; use SocialiteProviders\Manager\Contracts\ConfigInterface; use SocialiteProviders\Manager\Exception\MissingConfigException; +use SocialiteProviders\Manager\Contracts\Helpers\ConfigRetrieverInterface; -class ConfigRetriever implements \SocialiteProviders\Manager\Contracts\Helpers\ConfigRetrieverInterface +class ConfigRetriever implements ConfigRetrieverInterface { /** * @var string diff --git a/src/OAuth1/AbstractProvider.php b/src/OAuth1/AbstractProvider.php index 10c0ebd..3ffcc52 100644 --- a/src/OAuth1/AbstractProvider.php +++ b/src/OAuth1/AbstractProvider.php @@ -2,11 +2,13 @@ namespace SocialiteProviders\Manager\OAuth1; +use Laravel\Socialite\One\AbstractProvider as BaseProvider; use SocialiteProviders\Manager\SocialiteWasCalled; -use Symfony\Component\HttpFoundation\RedirectResponse; use SocialiteProviders\Manager\ConfigTrait; +use SocialiteProviders\Manager\Contracts\ConfigInterface as Config; +use Symfony\Component\HttpFoundation\RedirectResponse; -abstract class AbstractProvider extends \Laravel\Socialite\One\AbstractProvider +abstract class AbstractProvider extends BaseProvider { use ConfigTrait; @@ -150,4 +152,16 @@ public function with(array $parameters) return $this; } + + /** + * @param Config $config + * + * @return $this + */ + public function setConfig(Config $config) + { + $this->config = $this->server->setConfig($config); + + return $this; + } } diff --git a/src/OAuth1/Server.php b/src/OAuth1/Server.php index cf8b10a..ab51692 100644 --- a/src/OAuth1/Server.php +++ b/src/OAuth1/Server.php @@ -5,9 +5,13 @@ use GuzzleHttp\Exception\BadResponseException; use League\OAuth1\Client\Credentials\TemporaryCredentials; use League\OAuth1\Client\Credentials\TokenCredentials; +use SocialiteProviders\Manager\ConfigTrait; +use League\OAuth1\Client\Server\Server as BaseServer; -abstract class Server extends \League\OAuth1\Client\Server\Server +abstract class Server extends BaseServer { + use ConfigTrait; + /** * The custom parameters to be sent with the request. * diff --git a/src/OAuth1/User.php b/src/OAuth1/User.php index 68506d6..e348db6 100644 --- a/src/OAuth1/User.php +++ b/src/OAuth1/User.php @@ -2,7 +2,9 @@ namespace SocialiteProviders\Manager\OAuth1; -class User extends \Laravel\Socialite\One\User +use Laravel\Socialite\One\User as BaseUser; + +class User extends BaseUser { /** * The User Credentials. diff --git a/src/OAuth2/AbstractProvider.php b/src/OAuth2/AbstractProvider.php index 6be9aa1..e842000 100644 --- a/src/OAuth2/AbstractProvider.php +++ b/src/OAuth2/AbstractProvider.php @@ -7,8 +7,9 @@ use SocialiteProviders\Manager\Contracts\OAuth2\ProviderInterface; use SocialiteProviders\Manager\SocialiteWasCalled; use SocialiteProviders\Manager\ConfigTrait; +use Laravel\Socialite\Two\AbstractProvider as BaseProvider; -abstract class AbstractProvider extends \Laravel\Socialite\Two\AbstractProvider implements ProviderInterface +abstract class AbstractProvider extends BaseProvider implements ProviderInterface { use ConfigTrait; diff --git a/src/OAuth2/User.php b/src/OAuth2/User.php index 472c117..69ff690 100644 --- a/src/OAuth2/User.php +++ b/src/OAuth2/User.php @@ -2,7 +2,9 @@ namespace SocialiteProviders\Manager\OAuth2; -class User extends \Laravel\Socialite\Two\User +use Laravel\Socialite\Two\User as BaseUser; + +class User extends BaseUser { /** * The User Credentials.