Completed
Push — master ( 0f5e6b...d874fd )
by Conrad
01:54
created

src/Exceptions/AuthenticationException.php (1 issue)

parameters with defaults are at the end.

Coding Style Informational

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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