AuthenticationException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResponse() 0 4 1
1
<?php
2
3
namespace AdvancedLearning\Oauth2Server\Exceptions;
4
5
6
use Exception;
7
use SilverStripe\Control\HTTPResponse;
8
use Throwable;
9
10
class AuthenticationException extends Exception
11
{
12
    protected $response;
13
14
    /**
15
     * AuthenticationException constructor.
16
     *
17
     * @param string         $message  Exception message.
18
     * @param int            $code     Error code.
19
     * @param HTTPResponse   $response Response object for error.
20
     * @param Throwable|null $previous Previous exception.
21
     */
22
    public function __construct($message = "", $code = 0, HTTPResponse $response, Throwable $previous = null)
0 ignored issues
show
Coding Style introduced by Conrad
Parameters which have default values should be placed at the end.

If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway:

// $a must always be passed; it's default value is never used.
function someFunction($a = 5, $b) { }
Loading history...
23
    {
24
        $this->response = $response;
25
        parent::__construct($message, $code, $previous);
26
    }
27
28
    /**
29
     * Get the error response object.
30
     *
31
     * @return HTTPResponse
32
     */
33
    public function getResponse()
34
    {
35
        return $this->response;
36
    }
37
}
38