1 | <?php |
||
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 | 10 | public function __construct($contents = []) { |
|
24 | |||
25 | 10 | public function merge($contents, $strategy = self::PREFER_ORIGINAL) { |
|
26 | 10 | $data = CollectionUtils::toMap($contents); |
|
27 | |||
28 | 10 | $this->mergeFields($this->name, $data->get('name'), $strategy); |
|
29 | 10 | $this->mergeFields($this->url, $data->get('url'), $strategy); |
|
30 | 10 | $this->mergeFields($this->email, $data->get('email'), $strategy); |
|
31 | |||
32 | // extensions |
||
33 | 10 | $this->parseExtensions($data); |
|
34 | 10 | } |
|
35 | |||
36 | 7 | public function toArray() { |
|
39 | |||
40 | /** |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | 1 | public function getName() { |
|
47 | |||
48 | /** |
||
49 | * |
||
50 | * @param string $name |
||
51 | * @return $this |
||
52 | */ |
||
53 | 1 | public function setName($name) { |
|
57 | |||
58 | /** |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 1 | public function getUrl() { |
|
65 | |||
66 | /** |
||
67 | * |
||
68 | * @param string $url |
||
69 | * @return $this |
||
70 | */ |
||
71 | 1 | public function setUrl($url) { |
|
75 | |||
76 | /** |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 1 | public function getEmail() { |
|
83 | |||
84 | /** |
||
85 | * |
||
86 | * @param string $email |
||
87 | * @return $this |
||
88 | */ |
||
89 | 1 | public function setEmail($email) { |
|
93 | |||
94 | } |
||
95 |