Test Failed
Pull Request — master (#80)
by Maximo
06:05
created

library/Middleware/TokenBase.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Middleware;
6
7
use Gewaer\Http\Request;
8
use Gewaer\Traits\QueryTrait;
0 ignored issues
show
The type Gewaer\Traits\QueryTrait was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Gewaer\Traits\ResponseTrait;
10
use Gewaer\Traits\TokenTrait;
11
use Phalcon\Mvc\Micro\MiddlewareInterface;
12
use Gewaer\Exception\NotFoundHttpException;
13
14
/**
15
 * Class AuthenticationMiddleware.
16
 *
17
 * @package Niden\Middleware
18
 */
19
abstract class TokenBase implements MiddlewareInterface
20
{
21
    use ResponseTrait;
0 ignored issues
show
The trait Gewaer\Traits\ResponseTrait requires the property $response which is not provided by Gewaer\Middleware\TokenBase.
Loading history...
22
    use TokenTrait;
23
24
    /**
25
     * @param Request $request
26
     *
27
     * @return bool
28
     */
29 69
    protected function isValidCheck(Request $request): bool
30
    {
31 69
        if (!$request->ignoreJwt() && $request->isEmptyBearerToken()) {
32 1
            throw new NotFoundHttpException('Missing Token');
33
        }
34
35
        return (
36 68
            true !== $request->ignoreJwt()
37
        );
38
    }
39
}
40