ExternalDocs   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 5
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A parse() 0 8 1
A toArray() 0 3 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