ExternalDocs::__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\DescriptionPart;
5
use gossi\swagger\parts\ExtensionPart;
6
use gossi\swagger\parts\UrlPart;
7
use phootwork\collection\CollectionUtils;
8
use phootwork\lang\Arrayable;
9
10
class ExternalDocs extends AbstractModel implements Arrayable {
11
12
	use DescriptionPart;
13
	use UrlPart;
14
	use ExtensionPart;
15
16 13
	public function __construct($contents = []) {
17 13
		$this->parse($contents);
18 13
	}
19
20 13
	private function parse($contents = []) {
21 13
		$data = CollectionUtils::toMap($contents);
22
23
		// parts
24 13
		$this->parseDescription($data);
25 13
		$this->parseUrl($data);
26 13
		$this->parseExtensions($data);
27 13
	}
28
29 11
	public function toArray() {
30 11
		return $this->export('description', 'url');
31
	}
32
33
}
34