Failed Conditions
Pull Request — feature/init (#3)
by Yo
01:46
created

ServerDoc::addMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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