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

ItemsPart::parseItems()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace gossi\swagger\parts;
4
5
use gossi\swagger\Items;
6
use gossi\swagger\util\MergeHelper;
7
use phootwork\collection\Map;
8
9
trait ItemsPart {
10
11
	/** @var */
12
	private $items;
13 9
14 9
	private function parseItems(Map $data) {
15 6
		if ($data->has('items')) {
16 6
			$this->items = new Items($data->get('items'));
17 9
		}
18
	}
19
20
	private function mergeItems(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...
21
		if (null === $this->items) {
22
			$this->items = clone $model->items;
23
		} elseif (null !== $model->items) {
24
			$this->items->merge($model->items, $overwrite);
25
		}
26
	}
27
28
	/**
29
	 * Returns the items
30
	 *
31
	 * @return Items
32
	 */
33
	public function getItems() {
34
		if ($this->items === null) {
35
			$this->items = new Items();
36
		}
37
38
		return $this->items;
39
	}
40
}
41