JsonExceptionResponse::getStatusCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pagantis\ModuleUtils\Model\Response;
4
5
/**
6
 * Class JsonExceptionResponse
7
 * @package Pagantis\ModuleUtils\Model
8
 */
9
class JsonExceptionResponse extends AbstractJsonResponse
10
{
11
    /**
12
     * RESULT_DESCRIPTION
13
     */
14
    const RESULT = 'Order not confirmed';
15
16
    /**
17
     * STATUS_CODE
18
     */
19
    const STATUS_CODE = 500;
20
21
    /**
22
     * @var string $result
23
     */
24
    protected $result;
25
26
    /**
27
     * @var int $status
28
     */
29
    protected $statusCode;
30
31
    /**
32
     * JsonExceptionResponse constructor.
33
     */
34
    public function __construct()
35
    {
36
        $this->result = self::RESULT;
37
        $this->statusCode = self::STATUS_CODE;
38
39
        parent::__construct();
40
    }
41
42
    /**
43
     * @param \Exception $exception
44
     */
45
    public function setException(\Exception $exception)
46
    {
47
        $this->result = $exception->getMessage();
48
        $this->statusCode = $exception->getCode();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getResult()
55
    {
56
        return $this->result;
57
    }
58
59
    /**
60
     * @param string $result
61
     */
62
    public function setResult($result)
63
    {
64
        $this->result = $result;
65
    }
66
67
    /**
68
     * @return int
69
     */
70
    public function getStatusCode()
71
    {
72
        return $this->statusCode;
73
    }
74
75
    /**
76
     * @param int $statusCode
77
     */
78
    public function setStatusCode($statusCode)
79
    {
80
        $this->statusCode = $statusCode;
81
    }
82
}
83