ServerDoc::addGlobalError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
namespace Yoanm\JsonRpcServerDoc\Domain\Model;
3
4
/**
5
 * Class ServerDoc
6
 */
7
class ServerDoc
8
{
9
    /** @var string|null */
10
    private $name;
11
    /** @var string|null */
12
    private $version;
13
    /** @var MethodDoc[] */
14
    private $methodList = [];
15
    /** @var TagDoc[] */
16
    private $tagList = [];
17
    /** @var ErrorDoc[] */
18
    private $serverErrorList = [];
19
    /** @var ErrorDoc[] */
20
    private $globalErrorList = [];
21
22
    /**
23
     * @param string $name
24
     *
25
     * @return self
26
     */
27 5
    public function setName(string $name) : self
28
    {
29 5
        $this->name = $name;
30
31 5
        return $this;
32
    }
33
34
    /**
35
     * @param string $version
36
     *
37
     * @return self
38
     */
39 3
    public function setVersion(string $version) : self
40
    {
41 3
        $this->version = $version;
42
43 3
        return $this;
44
    }
45
46
    /**
47
     * @param MethodDoc $method
48
     *
49
     * @return self
50
     */
51 5
    public function addMethod(MethodDoc $method) : self
52
    {
53 5
        $this->methodList[] = $method;
54
55 5
        return $this;
56
    }
57
58
    /**
59
     * @param TagDoc $tag
60
     *
61
     * @return self
62
     */
63 5
    public function addTag(TagDoc $tag) : self
64
    {
65 5
        $this->tagList[] = $tag;
66
67 5
        return $this;
68
    }
69
70
    /**
71
     * @param ErrorDoc $error
72
     *
73
     * @return self
74
     */
75 5
    public function addServerError(ErrorDoc $error) : self
76
    {
77 5
        $this->serverErrorList[] = $error;
78
79 5
        return $this;
80
    }
81
82
    /**
83
     * @param ErrorDoc $error
84
     *
85
     * @return self
86
     */
87 5
    public function addGlobalError(ErrorDoc $error) : self
88
    {
89 5
        $this->globalErrorList[] = $error;
90
91 5
        return $this;
92
    }
93
94
    /**
95
     * @return string|null
96
     */
97 13
    public function getName() : ?string
98
    {
99 13
        return $this->name;
100
    }
101
102
    /**
103
     * @return string|null
104
     */
105 13
    public function getVersion() : ?string
106
    {
107 13
        return $this->version;
108
    }
109
110
    /**
111
     * @return MethodDoc[]
112
     */
113 13
    public function getMethodList() : array
114
    {
115 13
        return $this->methodList;
116
    }
117
118
    /**
119
     * @return TagDoc[]
120
     */
121 13
    public function getTagList() : array
122
    {
123 13
        return $this->tagList;
124
    }
125
126
    /**
127
     * @return ErrorDoc[]
128
     */
129 13
    public function getServerErrorList() : array
130
    {
131 13
        return $this->serverErrorList;
132
    }
133
134
    /**
135
     * @return ErrorDoc[]
136
     */
137 13
    public function getGlobalErrorList() : array
138
    {
139 13
        return $this->globalErrorList;
140
    }
141
}
142