-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContact.php
More file actions
92 lines (70 loc) · 1.55 KB
/
Contact.php
File metadata and controls
92 lines (70 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php declare(strict_types = 1);
namespace Contributte\OpenApi\Schema;
class Contact
{
private ?string $name = null;
private ?string $url = null;
private ?string $email = null;
private ?VendorExtensions $vendorExtensions = null;
/**
* @param array{name?: string, url?: string, email?: string} $data
*/
public static function fromArray(array $data): Contact
{
$contact = new Contact();
$contact->setName($data['name'] ?? null);
$contact->setUrl($data['url'] ?? null);
$contact->setEmail($data['email'] ?? null);
$contact->setVendorExtensions(VendorExtensions::fromArray($data));
return $contact;
}
/**
* @return mixed[]
*/
public function toArray(): array
{
$data = [];
if ($this->name !== null) {
$data['name'] = $this->name;
}
if ($this->url !== null) {
$data['url'] = $this->url;
}
if ($this->email !== null) {
$data['email'] = $this->email;
}
return $data;
}
public function setName(?string $name): void
{
$this->name = $name;
}
public function setUrl(?string $url): void
{
$this->url = $url;
}
public function setEmail(?string $email): void
{
$this->email = $email;
}
public function getName(): ?string
{
return $this->name;
}
public function getUrl(): ?string
{
return $this->url;
}
public function getEmail(): ?string
{
return $this->email;
}
public function getVendorExtensions(): ?VendorExtensions
{
return $this->vendorExtensions;
}
public function setVendorExtensions(?VendorExtensions $vendorExtensions): void
{
$this->vendorExtensions = $vendorExtensions;
}
}