Passed
Pull Request — master (#5)
by Samuel
02:12
created

OAuthServerHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SMartins\Exceptions\Handlers;
4
5
use SMartins\Exceptions\JsonApi\Error;
6
use SMartins\Exceptions\JsonApi\Source;
7
use League\OAuth2\Server\Exception\OAuthServerException;
0 ignored issues
show
Bug introduced by
The type League\OAuth2\Server\Exc...on\OAuthServerException 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...
8
9
class OAuthServerHandler extends AbstractHandler
10
{
11
    /**
12
     * Create instance using the Exception to be handled.
13
     *
14
     * @param \League\OAuth2\Server\Exception\OAuthServerException $e
15
     */
16
    public function __construct(OAuthServerException $e)
17
    {
18
        parent::__construct($e);
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function handle()
25
    {
26
        return (new Error)->setStatus($this->getHttpStatusCode())
0 ignored issues
show
Bug introduced by
The method getHttpStatusCode() does not exist on SMartins\Exceptions\Handlers\OAuthServerHandler. Did you maybe mean getStatusCode()? ( Ignorable by Annotation )

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

26
        return (new Error)->setStatus($this->/** @scrutinizer ignore-call */ getHttpStatusCode())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
27
            ->setCode($this->getCode())
28
            ->setSource((new Source())->setPointer($this->getDefaultPointer()))
29
            ->setTitle($this->exception->getErrorType())
0 ignored issues
show
Bug introduced by
The method getErrorType() does not exist on Exception. ( Ignorable by Annotation )

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

29
            ->setTitle($this->exception->/** @scrutinizer ignore-call */ getErrorType())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
            ->setDetail($this->exception->getMessage());
31
    }
32
}
33