Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 3, 2020
1 parent 822fd55 commit f30df69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
21 changes: 10 additions & 11 deletions src/Guard.php
Expand Up @@ -15,25 +15,25 @@ class Guard
protected $auth;

/**
* The provider name.
* The number of minutes tokens should be allowed to remain valid.
*
* @var string
* @var int
*/
protected $provider;
protected $expiration;

/**
* The number of minutes tokens should be allowed to remain valid.
* The provider name.
*
* @var int
* @var string
*/
protected $expiration;
protected $provider;

/**
* Create a new guard instance.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
* @param int $expiration
* @param string $provider
* @param string $provider
* @return void
*/
public function __construct(AuthFactory $auth, $expiration = null, $provider = null)
Expand Down Expand Up @@ -89,15 +89,14 @@ protected function supportsTokens($tokenable = null)
}

/**
* Determine if the Token Provider Correct.
* Determine if the tokenable model matches the provider's model type.
*
* @param \Illuminate\Database\Eloquent\Model $tokenable
* @param \Illuminate\Database\Eloquent\Model $tokenable
* @return bool
*/
protected function hasValidProvider($tokenable)
{
// If provider is null this method will return TRUE
if ($this->provider === null) {
if (is_null($this->provider)) {
return true;
}

Expand Down
13 changes: 7 additions & 6 deletions src/SanctumServiceProvider.php
Expand Up @@ -95,7 +95,7 @@ protected function configureGuard()
{
Auth::resolved(function ($auth) {
$auth->extend('sanctum', function ($app, $name, array $config) use ($auth) {
return tap($this->registerGuard($auth, $config), function ($guard) {
return tap($this->createGuard($auth, $config), function ($guard) {
$this->app->refresh('request', $guard, 'setRequest');
});
});
Expand All @@ -105,16 +105,17 @@ protected function configureGuard()
/**
* Register the guard.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
* @param \Illuminate\Contracts\Auth\Factory $auth
* @param array $config
* @return RequestGuard
*/
protected function registerGuard($auth, $config)
protected function createGuard($auth, $config)
{
return new RequestGuard(
new Guard($auth, config('sanctum.expiration'), $config['provider']),
$this->app['request'],
$auth->createUserProvider());
new Guard($auth, config('sanctum.expiration'), $config['provider']),
$this->app['request'],
$auth->createUserProvider()
);
}

/**
Expand Down

0 comments on commit f30df69

Please sign in to comment.