Items::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace gossi\swagger;
3
4
use gossi\swagger\parts\ExtensionPart;
5
use gossi\swagger\parts\ItemsPart;
6
use gossi\swagger\parts\RefPart;
7
use gossi\swagger\parts\TypePart;
8
use phootwork\collection\CollectionUtils;
9
use phootwork\lang\Arrayable;
10
11
class Items extends AbstractModel implements Arrayable {
12
13
	use RefPart;
14
	use TypePart;
15
	use ItemsPart;
16
	use ExtensionPart;
17
18 6
	public function __construct($contents = []) {
19 6
		$this->parse($contents);
20 6
	}
21
22 6
	private function parse($contents = []) {
23 6
		$data = CollectionUtils::toMap($contents);
24
25
		// parts
26 6
		$this->parseRef($data);
27 6
		$this->parseType($data);
28 6
		$this->parseItems($data);
29 6
		$this->parseExtensions($data);
30 6
	}
31
32 6
	public function toArray() {
33 6
		return $this->export($this->getTypeExportFields(), 'items');
34
	}
35
36
}
37