Completed
Push — master ( c915d2...2ad4b2 )
by Alexander
04:32
created

ApiException::getStatusCode()   A

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 Flugg\Responder\Exceptions;
4
5
use Symfony\Component\HttpKernel\Exception\HttpException;
6
7
abstract class ApiException extends HttpException
8
{
9
    /**
10
     * The HTTP status code.
11
     *
12
     * @var int
13
     */
14
    protected $statusCode = 500;
15
16
    /**
17
     * The error code used for API responses.
18
     *
19
     * @var string
20
     */
21
    protected $errorCode = 'error_occurred';
22
23
    /**
24
     * Constructor.
25
     *
26
     * @param mixed $message
27
     */
28
    public function __construct( $message = null )
29
    {
30
        parent::__construct( $this->statusCode, $message );
31
    }
32
33
    /**
34
     * Get the HTTP status code,
35
     *
36
     * @return int
37
     */
38
    public function getStatusCode()
39
    {
40
        return $this->statusCode;
41
    }
42
43
    /**
44
     * Get the error code.
45
     *
46
     * @return string
47
     */
48
    public function getErrorCode()
49
    {
50
        return $this->errorCode;
51
    }
52
}