1 | <?php |
||
23 | class OAuthMiddleware |
||
24 | { |
||
25 | /** |
||
26 | * The Authorizer instance. |
||
27 | * |
||
28 | * @var \LucaDegasperi\OAuth2Server\Authorizer |
||
29 | */ |
||
30 | protected $authorizer; |
||
31 | |||
32 | /** |
||
33 | * Whether or not to check the http headers only for an access token. |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $httpHeadersOnly = false; |
||
38 | |||
39 | /** |
||
40 | * Create a new oauth middleware instance. |
||
41 | * |
||
42 | * @param \LucaDegasperi\OAuth2Server\Authorizer $authorizer |
||
43 | * @param bool $httpHeadersOnly |
||
44 | */ |
||
45 | public function __construct(Authorizer $authorizer, $httpHeadersOnly = false) |
||
50 | |||
51 | /** |
||
52 | * Handle an incoming request. |
||
53 | * |
||
54 | * @param \Illuminate\Http\Request $request |
||
55 | * @param \Closure $next |
||
56 | * @param string|null $scopesString |
||
57 | * |
||
58 | * @throws \League\OAuth2\Server\Exception\InvalidScopeException |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | public function handle($request, Closure $next, $scopesString = null) |
||
79 | |||
80 | /** |
||
81 | * Validate the scopes. |
||
82 | * |
||
83 | * @param $scopes |
||
84 | * |
||
85 | * @throws \League\OAuth2\Server\Exception\InvalidScopeException |
||
86 | */ |
||
87 | public function validateCombinations($combinations) |
||
101 | |||
102 | /** |
||
103 | * Validate the scopes. |
||
104 | * |
||
105 | * @param $scopes |
||
106 | * |
||
107 | * @throws \League\OAuth2\Server\Exception\InvalidScopeException |
||
108 | */ |
||
109 | public function validateScopes($scopes) |
||
116 | } |
||
117 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.