| Total Complexity | 4 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 7 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | * 中间件. |
||
| 14 | */ |
||
| 15 | class Jwt |
||
| 16 | { |
||
| 17 | private $jwt; |
||
| 18 | private $app; |
||
| 19 | private $bearerToken; |
||
| 20 | |||
| 21 | public function __construct(App $app, BearerToken $bearerToken, Ac $jwt) |
||
| 26 | } |
||
| 27 | |||
| 28 | public function handle($request, \Closure $next) |
||
| 29 | { |
||
| 30 | $token = $this->bearerToken->getToken(); |
||
| 31 | if (true === $this->jwt->verify($token)) { |
||
| 32 | // 自动注入用户模型 |
||
| 33 | if ($this->jwt->injectUser()) { |
||
| 34 | $user = $this->jwt->user(); |
||
| 35 | // 路由注入 |
||
| 36 | $request->user = $user; |
||
| 37 | |||
| 38 | // 依赖注入 |
||
| 39 | $model = $this->jwt->userModel(); |
||
| 40 | $this->app->bind($model, $user); |
||
| 41 | } |
||
| 42 | |||
| 43 | $request->jwt = $this->jwt; |
||
| 44 | |||
| 45 | return $next($request); |
||
| 46 | } |
||
| 47 | |||
| 51 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths