Completed
Pull Request — master (#6)
by Guilh
04:05
created

ExternalDocs   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 3
c 4
b 1
f 0
lcom 1
cbo 5
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10
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 12
	public function __construct($contents = []) {
17 12
		$this->parse($contents);
18 12
	}
19
20 12
	private function parse($contents = []) {
21 12
		$data = CollectionUtils::toMap($contents);
22
23
		// parts
24 12
		$this->parseDescription($data);
25 12
		$this->parseUrl($data);
26 12
		$this->parseExtensions($data);
27 12
	}
28
29 10
	/**
30 10
	 * {@inheritdoc}
31
	 */
32
	public function merge(static $model, $overwrite = false) {
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STATIC, expecting T_VARIABLE
Loading history...
33
		$this->mergeDescription($model, $overwrite);
34
		$this->mergeUrl($model, $overwrite);
35
		$this->mergeExtensions($model, $overwrite);
36
	}
37
38
	public function toArray() {
39
		return $this->export('description', 'url');
40
	}
41
42
}
43