Completed
Pull Request — master (#119)
by Toby
65:37 queued 63:37
created

Error   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 2
dl 0
loc 66
ccs 0
cts 35
cp 0
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 4 1
A setAboutLink() 0 4 1
A setStatus() 0 4 1
A setCode() 0 4 1
A setTitle() 0 4 1
A setDetail() 0 4 1
A setSourcePointer() 0 4 1
A setSourceParameter() 0 4 1
A jsonSerialize() 0 13 1
1
<?php
2
3
/*
4
 * This file is part of JSON-API.
5
 *
6
 * (c) Toby Zerner <[email protected]>
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 Tobscure\JsonApi;
13
14
use JsonSerializable;
15
16
class Error implements JsonSerializable
17
{
18
    use LinksTrait;
19
    use MetaTrait;
20
21
    private $id;
22
    private $status;
23
    private $code;
24
    private $title;
25
    private $detail;
26
    private $source;
27
28
    public function setId($id)
29
    {
30
        $this->id = $id;
31
    }
32
33
    public function setAboutLink($link)
34
    {
35
        $this->links['about'] = $link;
36
    }
37
38
    public function setStatus($status)
39
    {
40
        $this->status = $status;
41
    }
42
43
    public function setCode($code)
44
    {
45
        $this->code = $code;
46
    }
47
48
    public function setTitle($title)
49
    {
50
        $this->title = $title;
51
    }
52
53
    public function setDetail($detail)
54
    {
55
        $this->detail = $detail;
56
    }
57
58
    public function setSourcePointer($pointer)
59
    {
60
        $this->source['pointer'] = $pointer;
61
    }
62
63
    public function setSourceParameter($parameter)
64
    {
65
        $this->source['parameter'] = $parameter;
66
    }
67
68
    public function jsonSerialize()
69
    {
70
        return array_filter([
71
            'id' => $this->id,
72
            'links' => $this->links,
73
            'status' => $this->status,
74
            'code' => $this->code,
75
            'title' => $this->title,
76
            'detail' => $this->detail,
77
            'source' => $this->source,
78
            'meta' => $this->meta
79
        ]);
80
    }
81
}
82