License::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace gossi\swagger;
3
4
use gossi\swagger\parts\ExtensionPart;
5
use gossi\swagger\parts\UrlPart;
6
use phootwork\collection\CollectionUtils;
7
use phootwork\lang\Arrayable;
8
9
class License extends AbstractModel implements Arrayable {
10
11
	use UrlPart;
12
	use ExtensionPart;
13
14
	/** @var string */
15
	private $name;
16
17 11
	public function __construct($contents = []) {
18 11
		$this->parse($contents);
19 11
	}
20
21 11
	private function parse($contents = []) {
22 11
		$data = CollectionUtils::toMap($contents);
23
24 11
		$this->name = $data->get('name');
25
26
		// extensions
27 11
		$this->parseUrl($data);
28 11
		$this->parseExtensions($data);
29 11
	}
30
31 8
	public function toArray() {
32 8
		return $this->export('name', 'url');
33
	}
34
35
	/**
36
	 *
37
	 * @return string
38
	 */
39 1
	public function getName() {
40 1
		return $this->name;
41
	}
42
43
	/**
44
	 *
45
	 * @param string $name
46
	 * @return $this
47
	 */
48 1
	public function setName($name) {
49 1
		$this->name = $name;
50 1
		return $this;
51
	}
52
53
}
54