Issues (62)

src/AuthenticationHandler.php (4 issues)

1
<?php
2
3
namespace SMartins\JsonHandler;
4
5
use Illuminate\Auth\AuthenticationException;
0 ignored issues
show
The type Illuminate\Auth\AuthenticationException 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...
6
7
trait AuthenticationHandler
8
{
9
    public function authenticationException(AuthenticationException $exception)
10
    {
11
        $error = [[
12
            'status'    => 401,
13
            'code'      => $this->getCode('authentication'),
0 ignored issues
show
It seems like getCode() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
            'code'      => $this->/** @scrutinizer ignore-call */ getCode('authentication'),
Loading history...
14
            'source'    => ['pointer' => $exception->getFile().':'.$exception->getLine()],
15
            'title'     => $exception->getMessage(),
16
            'detail'    => __('exception::exceptions.authentication.detail'),
0 ignored issues
show
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
            'detail'    => /** @scrutinizer ignore-call */ __('exception::exceptions.authentication.detail'),
Loading history...
17
        ]];
18
19
        $this->jsonApiResponse->setStatus(401);
0 ignored issues
show
Bug Best Practice introduced by
The property jsonApiResponse does not exist on SMartins\JsonHandler\AuthenticationHandler. Did you maybe forget to declare it?
Loading history...
20
        $this->jsonApiResponse->setErrors($error);
21
    }
22
}
23