Completed
Push — master ( 854a6f...c7bd33 )
by Chad
12s
created

AuthenticationException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 52
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getStatusCode() 0 4 1
A getReasonPhrase() 0 4 1
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