Completed
Push — master ( 819e89...46ea75 )
by Thomas
10:56
created

TypePart   B

Complexity

Total Complexity 37

Size/Duplication

Total Lines 380
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 24.27%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 37
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 380
ccs 25
cts 103
cp 0.2427
rs 8.6

34 Methods

Rating   Name   Duplication   Size   Complexity  
A parseType() 0 18 4
A getTypeExportFields() 0 6 1
A getType() 0 3 1
A setType() 0 4 1
A getFormat() 0 3 1
A setFormat() 0 4 1
A getCollectionFormat() 0 3 1
A setCollectionFormat() 0 4 1
A getDefault() 0 3 1
A setDefault() 0 4 1
A getMaximum() 0 3 1
A setMaximum() 0 4 1
A isExclusiveMaximum() 0 3 1
A setExclusiveMaximum() 0 4 1
A getMinimum() 0 3 1
A setMinimum() 0 4 1
A isExclusiveMinimum() 0 3 1
A setExclusiveMinimum() 0 4 1
A getMaxLength() 0 3 1
A setMaxLength() 0 4 1
A getMinLength() 0 3 1
A setMinLength() 0 4 1
A getPattern() 0 3 1
A setPattern() 0 4 1
A getMaxItems() 0 3 1
A setMaxItems() 0 4 1
A getMinItems() 0 3 1
A setMinItems() 0 4 1
A hasUniqueItems() 0 3 1
A setUniqueItems() 0 4 1
A getEnum() 0 3 1
A setEnum() 0 4 1
A getMultipleOf() 0 3 1
A setMultipleOf() 0 4 1
1
<?php
2
namespace gossi\swagger\parts;
3
4
use phootwork\collection\Map;
5
6
trait TypePart {
7
	
8
	/** @var string */
9
	private $type;
10
	
11
	/** @var string */
12
	private $format;
13
	
14
	/** @var string */
15
	private $collectionFormat;
16
	
17
	/** @var mixed */
18
	private $default;
19
20
	/** @var float */
21
	private $maximum;
22
	
23
	/** @var boolean */
24
	private $exclusiveMaximum = false;
25
	
26
	/** @var float */
27
	private $minimum;
28
	
29
	/** @var boolean */
30
	private $exclusiveMinimum = false;
31
	
32
	/** @var int */
33
	private $maxLength;
34
	
35
	/** @var int */
36
	private $minLength;
37
	
38
	/** @var string */
39
	private $pattern;
40
	
41
	/** @var int */
42
	private $maxItems;
43
	
44
	/** @var int */
45
	private $minItems;
46
	
47
	/** @var boolean */
48
	private $uniqueItems;
49
	
50
	/** @var mixed */
51
	private $enum;
52
	
53
	/** @var float */
54
	private $multipleOf;
55
	
56 8
	private function parseType(Map $data) {
57 8
		$this->type = $data->get('type');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
58 8
		$this->format = $data->get('format');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
59 8
		$this->collectionFormat = $data->get('collectionFormat');
60 8
		$this->default = $data->get('default');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
61 8
		$this->maximum = $data->get('maximum');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
62 8
		$this->exclusiveMaximum = $data->has('exclusiveMaximum') && $data->get('exclusiveMaximum');
63 8
		$this->minimum = $data->get('minimum');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
64 8
		$this->exclusiveMinimum = $data->has('exclusiveMinimum') && $data->get('exclusiveMinimum');
65 8
		$this->maxLength = $data->get('maxLength');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
66 8
		$this->minLength = $data->get('minLength');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
67 8
		$this->pattern = $data->get('pattern');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
68 8
		$this->maxItems = $data->get('maxItems');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
69 8
		$this->minItems = $data->get('minItems');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
70 8
		$this->uniqueItems = $data->has('uniqueItems') && $data->get('uniqueItems');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
71 8
		$this->enum = $data->get('enum');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
72 8
		$this->multipleOf = $data->get('multipleOf');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
73 8
	}
74
	
75 5
	private function getTypeExportFields() {
76 5
		return ['type', 'format', 'collectionFormat', 'default', 'maximum', 'exclusiveMaximum',
77 5
			'minimum', 'exclusiveMinimum', 'maxLength', 'minLength', 'pattern', 'maxItems',
78 5
			'minItems', 'uniqueItems', 'enum', 'multipleOf'
79 5
		];
80
	}
81
82
	/**
83
	 *
84
	 * @return string
85
	 */
86 1
	public function getType() {
87 1
		return $this->type;
88
	}
89
	
90
	/**
91
	 *
92
	 * @param string $type
93
	 * @return $this
94
	 */
95
	public function setType($type) {
96
		$this->type = $type;
97
		return $this;
98
	}
99
	
100
	/**
101
	 *
102
	 * @return string
103
	 */
104
	public function getFormat() {
105
		return $this->format;
106
	}
107
	
108
	/**
109
	 * Sets the extending format for the type
110
	 *
111
	 * @param string $format
112
	 * @return $this
113
	 */
114
	public function setFormat($format) {
115
		$this->format = $format;
116
		return $this;
117
	}
118
	
119
	/**
120
	 *
121
	 * @return string
122
	 */
123
	public function getCollectionFormat() {
124
		return $this->collectionFormat;
125
	}
126
	
127
	/**
128
	 * Determines the format of the array if type array is used. Possible values are:
129
	 * 
130
	 * - `csv` - comma separated values `foo,bar`.
131
	 * - `ssv` - space separated values `foo bar`.
132
	 * - `tsv` - tab separated values `foo\tbar`.
133
	 * - `pipes` - pipe separated values `foo|bar`.
134
	 * - `multi` - corresponds to multiple parameter instances instead of multiple values for a 
135
	 * single instance `foo=bar&foo=baz`. This is valid only for parameters in "query" or "formData".
136
	 * 
137
	 * Default value is `csv`.
138
	 * 
139
	 * 
140
	 * @param string $collectionFormat
141
	 * @return $this
142
	 */
143
	public function setCollectionFormat($collectionFormat) {
144
		$this->collectionFormat = $collectionFormat;
145
		return $this;
146
	}
147
	
148
	/**
149
	 *
150
	 * @return mixed
151
	 */
152
	public function getDefault() {
153
		return $this->default;
154
	}
155
	
156
	/**
157
	 *
158
	 * @param mixed $default
159
	 * @return $this
160
	 */
161
	public function setDefault($default) {
162
		$this->default = $default;
163
		return $this;
164
	}
165
	
166
	/**
167
	 *
168
	 * @return float
169
	 */
170
	public function getMaximum() {
171
		return $this->maximum;
172
	}
173
	
174
	/**
175
	 *
176
	 * @param float $maximum
177
	 * @return $this
178
	 */
179
	public function setMaximum($maximum) {
180
		$this->maximum = $maximum;
181
		return $this;
182
	}
183
	
184
	/**
185
	 *
186
	 * @return boolean
187
	 */
188
	public function isExclusiveMaximum() {
189
		return $this->exclusiveMaximum;
190
	}
191
	
192
	/**
193
	 *
194
	 * @param boolean $exclusiveMaximum
195
	 * @return $this
196
	 */
197
	public function setExclusiveMaximum($exclusiveMaximum) {
198
		$this->exclusiveMaximum = $exclusiveMaximum;
199
		return $this;
200
	}
201
	
202
	/**
203
	 *
204
	 * @return float
205
	 */
206
	public function getMinimum() {
207
		return $this->minimum;
208
	}
209
	
210
	/**
211
	 *
212
	 * @param float $minimum
213
	 * @return $this
214
	 */
215
	public function setMinimum($minimum) {
216
		$this->minimum = $minimum;
217
		return $this;
218
	}
219
	
220
	/**
221
	 *
222
	 * @return boolean
223
	 */
224
	public function isExclusiveMinimum() {
225
		return $this->exclusiveMinimum;
226
	}
227
	
228
	/**
229
	 *
230
	 * @param boolean $exclusiveMinimum
231
	 * @return $this
232
	 */
233
	public function setExclusiveMinimum($exclusiveMinimum) {
234
		$this->exclusiveMinimum = $exclusiveMinimum;
235
		return $this;
236
	}
237
	
238
	/**
239
	 *
240
	 * @return int
241
	 */
242
	public function getMaxLength() {
243
		return $this->maxLength;
244
	}
245
	
246
	/**
247
	 *
248
	 * @param int $maxLength
249
	 * @return $this
250
	 */
251
	public function setMaxLength($maxLength) {
252
		$this->maxLength = $maxLength;
253
		return $this;
254
	}
255
	
256
	/**
257
	 *
258
	 * @return int
259
	 */
260
	public function getMinLength() {
261
		return $this->minLength;
262
	}
263
	
264
	/**
265
	 *
266
	 * @param int $minLength
267
	 * @return $this
268
	 */
269
	public function setMinLength($minLength) {
270
		$this->minLength = $minLength;
271
		return $this;
272
	}
273
	
274
	/**
275
	 *
276
	 * @return string
277
	 */
278
	public function getPattern() {
279
		return $this->pattern;
280
	}
281
	
282
	/**
283
	 *
284
	 * @param string $pattern
285
	 * @return $thi
0 ignored issues
show
Documentation introduced by
The doc-type $thi could not be parsed: Unknown type name "$thi" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
286
	 */
287
	public function setPattern($pattern) {
288
		$this->pattern = $pattern;
289
		return $this;
290
	}
291
	
292
	/**
293
	 *
294
	 * @return int
295
	 */
296
	public function getMaxItems() {
297
		return $this->maxItems;
298
	}
299
	
300
	/**
301
	 *
302
	 * @param int $maxItems
303
	 * @return $this
304
	 */
305
	public function setMaxItems($maxItems) {
306
		$this->maxItems = $maxItems;
307
		return $this;
308
	}
309
	
310
	/**
311
	 *
312
	 * @return int
313
	 */
314
	public function getMinItems() {
315
		return $this->minItems;
316
	}
317
	
318
	/**
319
	 *
320
	 * @param int $minItems
321
	 * @return $this
322
	 */
323
	public function setMinItems($minItems) {
324
		$this->minItems = $minItems;
325
		return $this;
326
	}
327
	
328
	/**
329
	 *
330
	 * @return boolean
331
	 */
332
	public function hasUniqueItems() {
333
		return $this->uniqueItems;
334
	}
335
	
336
	/**
337
	 *
338
	 * @param boolean $uniqueItems
339
	 * @return $this
340
	 */
341
	public function setUniqueItems($uniqueItems) {
342
		$this->uniqueItems = $uniqueItems;
343
		return $this;
344
	}
345
	
346
	/**
347
	 *
348
	 * @return mixed
349
	 */
350
	public function getEnum() {
351
		return $this->enum;
352
	}
353
	
354
	/**
355
	 *
356
	 * @param mixed $enum
357
	 * @return $this
358
	 */
359
	public function setEnum($enum) {
360
		$this->enum = $enum;
361
		return $this;
362
	}
363
	
364
	/**
365
	 *
366
	 * @return float
367
	 */
368
	public function getMultipleOf() {
369
		return $this->multipleOf;
370
	}
371
	
372
	/**
373
	 *
374
	 * @param float $multipleOf
375
	 * @return $this
376
	 */
377
	public function setMultipleOf($multipleOf) {
378
		$this->multipleOf = $multipleOf;
379
		return $this;
380
	}
381
	
382
	
383
	
384
	
385
}