Failed Conditions
Pull Request — feature/init (#3)
by Yo
01:45
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 TagDoc $tag
60
     *
61
     * @return ServerDoc
62
     */
63
    public function addTag(TagDoc $tag) : ServerDoc
64
    {
65
        $this->tagList[] = $tag;
66
67
        return $this;
68
    }
69
70
    /**
71
     * @param ErrorDoc $error
72
     *
73
     * @return ServerDoc
74
     */
75
    public function addServerError(ErrorDoc $error) : ServerDoc
76
    {
77
        $this->serverErrorList[] = $error;
78
79
        return $this;
80
    }
81
82
    /**
83
     * @param ErrorDoc $error
84
     *
85
     * @return ServerDoc
86
     */
87
    public function addMethodError(ErrorDoc $error) : ServerDoc
88
    {
89
        $this->methodErrorList[] = $error;
90
91
        return $this;
92
    }
93
94
    /**
95
     * @return null|string
96
     */
97
    public function getName()
98
    {
99
        return $this->name;
100
    }
101
102
    /**
103
     * @return null|string
104
     */
105
    public function getVersion()
106
    {
107
        return $this->version;
108
    }
109
110
    /**
111
     * @return MethodDoc[]
112
     */
113
    public function getMethodList() : array
114
    {
115
        return $this->methodList;
116
    }
117
118
    /**
119
     * @return TagDoc[]
120
     */
121
    public function getTagList() : array
122
    {
123
        return $this->tagList;
124
    }
125
126
    /**
127
     * @return ErrorDoc[]
128
     */
129
    public function getServerErrorList() : array
130
    {
131
        return $this->serverErrorList;
132
    }
133
134
    /**
135
     * @return ErrorDoc[]
136
     */
137
    public function getMethodErrorList() : array
138
    {
139
        return $this->methodErrorList;
140
    }
141
}
142