Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnabil230 committed Nov 2, 2023
1 parent 2a76ae3 commit be2e4fb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Http/Middleware/CheckCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public function handle($request, Closure $next, ...$scopes)
/**
* Generate a string representation of the middleware with specified scopes.
*
* @param array $scopes
* @param array $scopes
* @return string
*/
public static function using(...$scopes)
{
return static::class . ':' . implode(',', $scopes);
return static::class.':'.implode(',', $scopes);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Middleware/CheckForAnyScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public function handle($request, $next, ...$scopes)
/**
* Generate a string representation of the middleware with specified scopes.
*
* @param array $scopes
* @param array $scopes
* @return string
*/
public static function using(...$scopes)
{
return static::class . ':' . implode(',', $scopes);
return static::class.':'.implode(',', $scopes);
}
}
4 changes: 2 additions & 2 deletions src/Http/Middleware/CheckScopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public function handle($request, $next, ...$scopes)
/**
* Generate a string representation of the middleware with specified scopes.
*
* @param array $scopes
* @param array $scopes
* @return string
*/
public static function using(...$scopes)
{
return static::class . ':' . implode(',', $scopes);
return static::class.':'.implode(',', $scopes);
}
}
6 changes: 3 additions & 3 deletions src/Http/Middleware/CreateFreshApiToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public function handle($request, Closure $next, $guard = null)
/**
* Specify the guard for the middleware.
*
* @param string|null $guard
* @param string|null $guard
* @return string
*/
public static function using($guard = null)
{
$args = is_null($guard) ? '' : ':' . $guard;
$args = is_null($guard) ? '' : ':'.$guard;

return static::class . $args;
return static::class.$args;
}

/**
Expand Down
10 changes: 2 additions & 8 deletions tests/Feature/ActingAsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,14 @@ public function testActingAsWhenTheRouteIsProtectedByCheckScopesMiddleware()

public function testItCanGenerateDefinitionViaStaticMethod()
{
$signature = (string) CheckScopes::using();
$this->assertSame('Laravel\Passport\Http\Middleware\CheckScopes', $signature);

$signature = (string) CheckScopes::using('admin');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckScopes:admin', $signature);

$signature = (string) CheckScopes::using('admin', 'footest');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckScopes:admin,footest', $signature);

$signature = (string) CheckForAnyScope::using('admin', 'footest');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckForAnyScope:admin,footest', $signature);

$signature = (string) CheckForAnyScope::using('admin', 'footest');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckForAnyScope:admin,footest', $signature);
$signature = (string) CheckForAnyScope::using('admin');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckForAnyScope:admin', $signature);

$signature = (string) CheckForAnyScope::using('admin', 'footest');
$this->assertSame('Laravel\Passport\Http\Middleware\CheckForAnyScope:admin,footest', $signature);
Expand Down

0 comments on commit be2e4fb

Please sign in to comment.