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

RefPart::setRef()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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