Completed
Pull Request — master (#6)
by Guilh
02:50
created

ExternalDocs::merge()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
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 12
	public function __construct($contents = []) {
17 12
		$this->merge($contents);
18 12
	}
19
20 12
	public function merge($contents, $strategy = self::PREFER_ORIGINAL) {
0 ignored issues
show
Unused Code introduced by
The parameter $strategy is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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
	public function toArray() {
30 10
		return $this->export('description', 'url');
31
	}
32
33
}
34