OAuthServerException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A render() 0 4 1
A statusCode() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Oauth\Exceptions;
6
7
use Exception;
8
use Illuminate\Http\Response;
9
use League\OAuth2\Server\Exception\OAuthServerException as LeagueException;
10
11
class OAuthServerException extends Exception
12
{
13
    /**
14
     * The response to render.
15
     *
16
     * @var \Illuminate\Http\Response
17
     */
18
    protected $response;
19
20
    /**
21
     * Create a new OAuthServerException.
22
     *
23
     * @param \League\OAuth2\Server\Exception\OAuthServerException $e
24
     * @param \Illuminate\Http\Response                            $response
25
     *
26
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
27
     */
28
    public function __construct(LeagueException $e, Response $response)
29
    {
30
        parent::__construct($e->getMessage(), $e->getCode(), $e);
31
32
        $this->response = $response;
33
    }
34
35
    /**
36
     * Render the exception into an HTTP response.
37
     *
38
     * @param \Illuminate\Http\Request $request
39
     *
40
     * @return \Illuminate\Http\Response
41
     */
42
    public function render($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        return $this->response;
45
    }
46
47
    /**
48
     * Get the HTTP response status code.
49
     *
50
     * @return int
51
     */
52
    public function statusCode()
53
    {
54
        return $this->response->getStatusCode();
55
    }
56
}
57