AuthenticationException::getStatusCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Chadicus\Psr\Http\ServerMiddleware;
4
5
/**
6
 * Exception to throw when authentication fails.
7
 */
8
class AuthenticationException extends \Exception
9
{
10
    /**
11
     * The 3-digit integer result code to set.
12
     *
13
     * @var integer
14
     */
15
    private $statusCode;
16
17
    /**
18
     * The reason phrase to use with the provided status code.
19
     *
20
     * @var string
21
     */
22
    private $reasonPhrase;
23
24
    /**
25
     * Construct a new instance of this exception.
26
     *
27
     * @param integer $statusCode   The 3-digit integer result code to set.
28
     * @param string  $reasonPhrase The reason phrase to use with the provided status code.
29
     */
30
    public function __construct(int $statusCode, string $reasonPhrase)
31
    {
32
        parent::__construct();
33
        $this->statusCode = $statusCode;
34
        $this->reasonPhrase = $reasonPhrase;
35
    }
36
37
    /**
38
     * Gets the response status code.
39
     *
40
     * The status code is a 3-digit integer result code of the server's attempt
41
     * to understand and satisfy the request.
42
     *
43
     * @return integer Status code.
44
     */
45
    public function getStatusCode() : int
46
    {
47
        return $this->statusCode;
48
    }
49
50
    /**
51
     * Gets the response reason phrase associated with the status code.
52
     *
53
     * @return string Reason phrase
54
     */
55
    public function getReasonPhrase() : string
56
    {
57
        return $this->reasonPhrase;
58
    }
59
}
60