Completed
Push — master ( b98498...ed897d )
by Radu
04:47
created

Error::getStatus()   A

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
namespace WebServCo\Api\JsonApi;
3
4
final class Error
5
{
6
    protected $id;
7
    protected $links;
8
    protected $status;
9
    protected $code;
10
    protected $title;
11
    protected $detail;
12
    protected $source;
13
    protected $meta;
14
15
    public function __construct()
16
    {
17
        $this->meta = [];
18
    }
19
20
    public function getStatus()
21
    {
22
        return $this->status;
23
    }
24
25
    public function setStatus($status)
26
    {
27
        $this->status = $status;
28
    }
29
30
    public function setTitle($title)
31
    {
32
        $this->title = $title;
33
    }
34
35
    public function setDetail($detail)
36
    {
37
        $this->detail = $detail;
38
    }
39
40
    public function setMeta($key, $value)
41
    {
42
        $this->meta[$key] = $value;
43
    }
44
45
    public function toArray()
46
    {
47
        $array = [];
48
        foreach (get_object_vars($this) as $key => $value) {
49
            if (!empty($value)) {
50
                $array[$key] = $value;
51
            }
52
        }
53
        return $array;
54
    }
55
}
56