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

JsonRpcParamDocBackup   B

Complexity

Total Complexity 38

Size/Duplication

Total Lines 371
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 371
ccs 0
cts 155
cp 0
rs 8.3999
c 0
b 0
f 0
wmc 38

38 Methods

Rating   Name   Duplication   Size   Complexity  
A setInclusiveMin() 0 3 1
A getSiblingList() 0 3 1
A __construct() 0 3 1
A setMax() 0 3 1
A setInclusiveMax() 0 3 1
A getValidItemList() 0 3 1
A isBlankAllowed() 0 3 1
A isAllowExtraSibling() 0 3 1
A getExpectedValue() 0 3 1
A setExample() 0 3 1
A isRequired() 0 3 1
A getType() 0 3 1
A getDefault() 0 3 1
A setAllowExtraSibling() 0 3 1
A isAllOfValidItemList() 0 3 1
A isInclusiveMax() 0 3 1
A isInclusiveMin() 0 3 1
A setAllowMissingSibling() 0 3 1
A isAllowMissingSibling() 0 3 1
A getFormat() 0 3 1
A setName() 0 3 1
A setFormat() 0 3 1
A setDefault() 0 3 1
A isRoot() 0 3 1
A setAllOfValidItemList() 0 3 1
A getMax() 0 3 1
A addValidItem() 0 3 1
A getExample() 0 3 1
A setExpectedValue() 0 3 1
A addSibling() 0 3 1
A getMin() 0 3 1
A getName() 0 3 1
A setType() 0 5 1
A setNullable() 0 5 1
A setBlankAllowed() 0 5 1
A setRequired() 0 5 1
A setMin() 0 3 1
A isNullable() 0 3 1
1
<?php
2
namespace Yoanm\JsonRpcServerDoc\Model;
3
4
/**
5
 * Class JsonRpcParamDoc
6
 */
7
class JsonRpcParamDocBackup
8
{
9
    const TYPE_SCALAR = 'scalar';
10
    const TYPE_STRING = 'string';
11
    const TYPE_BOOL = 'bool';
12
    const TYPE_FLOAT = 'float';
13
    const TYPE_INT = 'int';
14
    const TYPE_ARRAY = 'array';
15
    const TYPE_OBJECT = 'object';
16
17
    public static $allowedTypeList = [
18
        self::TYPE_SCALAR,
19
        self::TYPE_STRING,
20
        self::TYPE_BOOL,
21
        self::TYPE_FLOAT,
22
        self::TYPE_INT,
23
        self::TYPE_ARRAY,
24
        self::TYPE_OBJECT,
25
    ];
26
27
    /** @var null|string|integer */
28
    private $name = null;
29
    /** @var null|string */
30
    private $type;
31
32
    /** @var bool */
33
    private $required = false;
34
    /** @var null|bool */
35
    private $nullable = null;
36
37
    /** @var null|bool */
38
    private $blankAllowed = null;
39
    /** @var null|string */
40
    private $format = null;
41
42
43
    /** @var JsonRpcParamDoc[] */
44
    private $validItemList = [];
45
    /** @var bool */
46
    private $allOfValidItemList = false;
47
48
    /** @var JsonRpcParamDoc[] */
49
    private $siblingList = [];
50
    /** @var bool */
51
    private $allowExtraSibling = true;
52
    /** @var bool */
53
    private $allowMissingSibling = true;
54
55
56
57
    /** @var null|mixed */
58
    private $expectedValue;
59
60
    /**
61
     * @param bool|false $isRoot
62
     */
63
    public function __construct(bool $isRoot = false)
64
    {
65
        $this->isRoot = $isRoot;
0 ignored issues
show
Bug Best Practice introduced by
The property isRoot does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
66
    }
67
68
    /**
69
     * @param string|null $type
70
     *
71
     * @return JsonRpcParamDoc
72
     */
73
    public function setType($type) : JsonRpcParamDoc
74
    {
75
        $this->type = $type;
76
77
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDocBackup which is incompatible with the type-hinted return Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDoc.
Loading history...
78
    }
79
80
    /**
81
     * @param null|string|integer $name
82
     */
83
    public function setName($name)
84
    {
85
        $this->name = $name;
86
    }
87
88
    /**
89
     * @param bool $required
90
     *
91
     * @return JsonRpcParamDoc
92
     */
93
    public function setRequired(bool $required) : JsonRpcParamDoc
94
    {
95
        $this->required = $required;
96
97
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDocBackup which is incompatible with the type-hinted return Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDoc.
Loading history...
98
    }
99
100
    /**
101
     * @param bool $nullable
102
     *
103
     * @return JsonRpcParamDoc
104
     */
105
    public function setNullable(bool $nullable) : JsonRpcParamDoc
106
    {
107
        $this->nullable = $nullable;
108
109
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDocBackup which is incompatible with the type-hinted return Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDoc.
Loading history...
110
    }
111
112
    /**
113
     * @param bool $blankAllowed
114
     *
115
     * @return JsonRpcParamDoc
116
     */
117
    public function setBlankAllowed(bool $blankAllowed) : JsonRpcParamDoc
118
    {
119
        $this->blankAllowed = $blankAllowed;
120
121
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDocBackup which is incompatible with the type-hinted return Yoanm\JsonRpcServerDoc\Model\JsonRpcParamDoc.
Loading history...
122
    }
123
124
    /**
125
     * @param boolean $allOfValidItemList
126
     */
127
    public function setAllOfValidItemList(bool $allOfValidItemList)
128
    {
129
        $this->allOfValidItemList = $allOfValidItemList;
130
    }
131
132
    /**
133
     * @param mixed|null $expectedValue
134
     */
135
    public function setExpectedValue($expectedValue)
136
    {
137
        $this->expectedValue = $expectedValue;
138
    }
139
140
    /**
141
     * @param null $min
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $min is correct as it would always require null to be passed?
Loading history...
142
     */
143
    public function setMin($min)
144
    {
145
        $this->min = $min;
0 ignored issues
show
Bug Best Practice introduced by
The property min does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
146
    }
147
148
    /**
149
     * @param null $max
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $max is correct as it would always require null to be passed?
Loading history...
150
     */
151
    public function setMax($max)
152
    {
153
        $this->max = $max;
0 ignored issues
show
Bug Best Practice introduced by
The property max does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
154
    }
155
156
    /**
157
     * @param boolean $inclusiveMax
158
     */
159
    public function setInclusiveMax($inclusiveMax)
160
    {
161
        $this->inclusiveMax = $inclusiveMax;
0 ignored issues
show
Bug Best Practice introduced by
The property inclusiveMax does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
162
    }
163
164
    /**
165
     * @param boolean $inclusiveMin
166
     */
167
    public function setInclusiveMin($inclusiveMin)
168
    {
169
        $this->inclusiveMin = $inclusiveMin;
0 ignored issues
show
Bug Best Practice introduced by
The property inclusiveMin does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
170
    }
171
172
    /**
173
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
174
     */
175
    public function setFormat($format)
176
    {
177
        $this->format = $format;
178
    }
179
180
    /**
181
     * @param boolean $allowExtraSibling
182
     */
183
    public function setAllowExtraSibling(bool $allowExtraSibling)
184
    {
185
        $this->allowExtraSibling = $allowExtraSibling;
186
    }
187
188
    /**
189
     * @param boolean $allowMissingSibling
190
     */
191
    public function setAllowMissingSibling(bool $allowMissingSibling)
192
    {
193
        $this->allowMissingSibling = $allowMissingSibling;
194
    }
195
196
    /**
197
     * @param JsonRpcParamDoc $doc
198
     */
199
    public function addSibling(JsonRpcParamDoc $doc)
200
    {
201
        $this->siblingList[] = $doc;
202
    }
203
204
    /**
205
     * @param JsonRpcParamDoc $validItem
206
     */
207
    public function addValidItem(JsonRpcParamDoc $validItem)
208
    {
209
        $this->validItemList[] = $validItem;
210
    }
211
212
    /**
213
     * @param mixed|null $default
214
     */
215
    public function setDefault($default)
216
    {
217
        $this->default = $default;
0 ignored issues
show
Bug Best Practice introduced by
The property default does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
218
    }
219
220
    /**
221
     * @param mixed|null $example
222
     */
223
    public function setExample($example)
224
    {
225
        $this->example = $example;
0 ignored issues
show
Bug Best Practice introduced by
The property example does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
226
    }
227
228
    /**
229
     * @return bool
230
     */
231
    public function isRoot()
232
    {
233
        return $this->isRoot;
234
    }
235
236
    /**
237
     * @return null|string
238
     */
239
    public function getType()
240
    {
241
        return $this->type;
242
    }
243
244
    /**
245
     * @return int|null|string
246
     */
247
    public function getName()
248
    {
249
        return $this->name;
250
    }
251
252
    /**
253
     * @return boolean
254
     */
255
    public function isRequired() : bool
256
    {
257
        return $this->required;
258
    }
259
260
    /**
261
     * @return bool|null
262
     */
263
    public function isNullable()
264
    {
265
        return $this->nullable;
266
    }
267
268
    /**
269
     * @return bool|null
270
     */
271
    public function isBlankAllowed()
272
    {
273
        return $this->blankAllowed;
274
    }
275
276
    /**
277
     * @return null
278
     */
279
    public function getMin()
280
    {
281
        return $this->min;
282
    }
283
284
    /**
285
     * @return null
286
     */
287
    public function getMax()
288
    {
289
        return $this->max;
290
    }
291
292
    /**
293
     * @return boolean
294
     */
295
    public function isInclusiveMin()
296
    {
297
        return $this->inclusiveMin;
298
    }
299
300
    /**
301
     * @return boolean
302
     */
303
    public function isInclusiveMax()
304
    {
305
        return $this->inclusiveMax;
306
    }
307
308
    /**
309
     * @return null
310
     */
311
    public function getFormat()
312
    {
313
        return $this->format;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->format also could return the type string which is incompatible with the documented return type null.
Loading history...
314
    }
315
316
    /**
317
     * @return JsonRpcParamDoc[]
318
     */
319
    public function getSiblingList()
320
    {
321
        return $this->siblingList;
322
    }
323
324
    /**
325
     * @return mixed|null
326
     */
327
    public function getExpectedValue()
328
    {
329
        return $this->expectedValue;
330
    }
331
332
    /**
333
     * @return boolean
334
     */
335
    public function isAllowExtraSibling()
336
    {
337
        return $this->allowExtraSibling;
338
    }
339
340
    /**
341
     * @return boolean
342
     */
343
    public function isAllowMissingSibling()
344
    {
345
        return $this->allowMissingSibling;
346
    }
347
348
    /**
349
     * @return boolean
350
     */
351
    public function isAllOfValidItemList()
352
    {
353
        return $this->allOfValidItemList;
354
    }
355
356
    /**
357
     * @return JsonRpcParamDoc[]
358
     */
359
    public function getValidItemList()
360
    {
361
        return $this->validItemList;
362
    }
363
364
    /**
365
     * @return mixed|null
366
     */
367
    public function getDefault()
368
    {
369
        return $this->default;
370
    }
371
372
    /**
373
     * @return mixed|null
374
     */
375
    public function getExample()
376
    {
377
        return $this->example;
378
    }
379
}
380