ItemsPart::getItems()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace gossi\swagger\parts;
4
5
use gossi\swagger\Items;
6
use phootwork\collection\Map;
7
8
trait ItemsPart {
9
10
	/** @var */
11
	private $items;
12
13 10
	private function parseItems(Map $data) {
14 10
		if ($data->has('items')) {
15 6
			$this->items = new Items($data->get('items'));
16 6
		}
17 10
	}
18
19
	/**
20
	 * Returns the items
21
	 * 
22
	 * @return Items
23
	 */
24
	public function getItems() {
25
		if ($this->items === null) {
26
			$this->items = new Items();
27
		}
28
29
		return $this->items;
30
	}
31
}
32