Completed
Push — master ( c68d07...2894e1 )
by WEBEWEB
01:36
created

ActionResponse::setStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Model\Response;
13
14
use JsonSerializable;
15
16
/**
17
 * Action response.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Model\Response
21
 */
22
class ActionResponse implements JsonSerializable {
23
24
    /**
25
     * Notify.
26
     *
27
     * @var string
28
     */
29
    private $notify;
30
31
    /**
32
     * Status.
33
     *
34
     * @var int
35
     */
36
    private $status;
37
38
    /**
39
     * Constructor.
40
     *
41
     * @param int $status The status.
42
     * @param string $notify The notify.
43
     */
44
    public function __construct($status = null, $notify = null) {
45
        $this->setNotify($notify);
46
        $this->setStatus($status);
47
    }
48
49
    /**
50
     * Get the notify.
51
     *
52
     * @return string Returns the notify.
53
     */
54
    public function getNotify() {
55
        return $this->notify;
56
    }
57
58
    /**
59
     * Get the status.
60
     *
61
     * @return int Returns the status.
62
     */
63
    public function getStatus() {
64
        return $this->status;
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function jsonSerialize() {
71
        return $this->toArray();
72
    }
73
74
    /**
75
     * Set the notify.
76
     *
77
     * @param string $notify The notify.
78
     * @return ActionResponse Returns this action response.
79
     */
80
    public function setNotify($notify) {
81
        $this->notify = $notify;
82
        return $this;
83
    }
84
85
    /**
86
     * Set the satuts.
87
     *
88
     * @param int $status The status.
89
     * @return ActionResponse Returns this action response.
90
     */
91
    public function setStatus($status) {
92
        $this->status = $status;
93
        return $this;
94
    }
95
96
    /**
97
     * Convert into an array representing this instance.
98
     *
99
     * @return array Returns an array representing this instance.
100
     */
101
    public function toArray() {
102
        return [
103
            "status" => $this->getStatus(),
104
            "notify" => $this->getNotify(),
105
        ];
106
    }
107
108
}
109