Contact::setUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace gossi\swagger;
3
4
use gossi\swagger\parts\ExtensionPart;
5
use phootwork\collection\CollectionUtils;
6
use phootwork\lang\Arrayable;
7
8
class Contact extends AbstractModel implements Arrayable {
9
10
	use ExtensionPart;
11
12
	/** @var string */
13
	private $name;
14
15
	/** @var string */
16
	private $url;
17
18
	/** @var string */
19
	private $email;
20
21 11
	public function __construct($contents = []) {
22 11
		$this->parse($contents);
23 11
	}
24
25 11
	private function parse($contents = []) {
26 11
		$data = CollectionUtils::toMap($contents);
27
28 11
		$this->name = $data->get('name');
29 11
		$this->url = $data->get('url');
30 11
		$this->email = $data->get('email');
31
32
		// extensions
33 11
		$this->parseExtensions($data);
34 11
	}
35
36 8
	public function toArray() {
37 8
		return $this->export('name', 'url', 'email');
38
	}
39
40
	/**
41
	 *
42
	 * @return string
43
	 */
44 1
	public function getName() {
45 1
		return $this->name;
46
	}
47
48
	/**
49
	 *
50
	 * @param string $name
51
	 * @return $this
52
	 */
53 1
	public function setName($name) {
54 1
		$this->name = $name;
55 1
		return $this;
56
	}
57
58
	/**
59
	 *
60
	 * @return string
61
	 */
62 1
	public function getUrl() {
63 1
		return $this->url;
64
	}
65
66
	/**
67
	 *
68
	 * @param string $url
69
	 * @return $this
70
	 */
71 1
	public function setUrl($url) {
72 1
		$this->url = $url;
73 1
		return $this;
74
	}
75
76
	/**
77
	 *
78
	 * @return string
79
	 */
80 1
	public function getEmail() {
81 1
		return $this->email;
82
	}
83
84
	/**
85
	 *
86
	 * @param string $email
87
	 * @return $this
88
	 */
89 1
	public function setEmail($email) {
90 1
		$this->email = $email;
91 1
		return $this;
92
	}
93
94
}
95