1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the php-epp2 library. |
5
|
|
|
* |
6
|
|
|
* (c) Gunter Grodotzki <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE file |
9
|
|
|
* that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace AfriCC\EPP\Frame\Command\Create; |
13
|
|
|
|
14
|
|
|
use AfriCC\EPP\Frame\Command\Create as CreateCommand; |
15
|
|
|
use AfriCC\EPP\ContactTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @link http://tools.ietf.org/html/rfc5733#section-3.2.1 |
19
|
|
|
*/ |
20
|
|
|
class Contact extends CreateCommand |
21
|
|
|
{ |
22
|
|
|
use ContactTrait; |
23
|
|
|
|
24
|
|
|
public function setId($id) |
25
|
|
|
{ |
26
|
|
|
$this->appendId('contact:id', $id); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function setName($name) |
30
|
|
|
{ |
31
|
|
|
$this->appendName('contact:postalInfo[@type=\'%s\']/contact:name', $name); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function setOrganization($org) |
35
|
|
|
{ |
36
|
|
|
$this->appendOrganization('contact:postalInfo[@type=\'%s\']/contact:org', $org); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function addStreet($street) |
40
|
|
|
{ |
41
|
|
|
$this->appendStreet('contact:postalInfo[@type=\'%s\']/contact:addr/contact:street[]', $street); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function setCity($city) |
45
|
|
|
{ |
46
|
|
|
$this->appendCity('contact:postalInfo[@type=\'%s\']/contact:addr/contact:city', $city); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function setProvince($sp) |
50
|
|
|
{ |
51
|
|
|
$this->appendProvince('contact:postalInfo[@type=\'%s\']/contact:addr/contact:sp', $sp); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function setPostalCode($pc) |
55
|
|
|
{ |
56
|
|
|
$this->appendPostalCode('contact:postalInfo[@type=\'%s\']/contact:addr/contact:pc', $pc); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setCountryCode($cc) |
60
|
|
|
{ |
61
|
|
|
$this->appendCountryCode('contact:postalInfo[@type=\'%s\']/contact:addr/contact:cc', $cc); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setVoice($voice) |
65
|
|
|
{ |
66
|
|
|
$this->appendVoice('contact:voice', $voice); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setFax($fax) |
70
|
|
|
{ |
71
|
|
|
$this->appendFax('contact:fax', $fax); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function setEmail($email) |
75
|
|
|
{ |
76
|
|
|
$this->appendEmail('contact:email', $email); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function setAuthInfo($pw = null) |
80
|
|
|
{ |
81
|
|
|
return $this->appendAuthInfo('contact:authInfo/contact:pw', $pw); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function addDisclose($value, $flag = 0) |
85
|
|
|
{ |
86
|
|
|
$this->appendDisclose(sprintf('contact:disclose[@flag=\'%d\']/contact:%s', (int)$flag, $value)); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Expect one of following keys or values. |
91
|
|
|
* Usage example: setContactRole(2) or setContactRole("admin') |
92
|
|
|
* |
93
|
|
|
* $role - 2 => "admin", |
94
|
|
|
* 3 => "reseller", |
95
|
|
|
* 4 => "technical_contact", |
96
|
|
|
* 5 => "registrant_holder" |
97
|
|
|
* @param $role |
98
|
|
|
* @throws \Exception |
99
|
|
|
*/ |
100
|
|
|
public function setContactRole($role) |
101
|
|
|
{ |
102
|
|
|
$this->appendRole('contact:role', $role); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Expect one of following keys or values. |
107
|
|
|
* Usage example: setContactType(1) or setContactType("company') |
108
|
|
|
* |
109
|
|
|
* $type - 0 => "private_person", |
110
|
|
|
* 1 => "company", |
111
|
|
|
* 2 => "corporation", |
112
|
|
|
* 3 => "institution", |
113
|
|
|
* 4 => "political_party", |
114
|
|
|
* 5 => "township", |
115
|
|
|
* 6 => "government", |
116
|
|
|
* 7 => "public_community" |
117
|
|
|
* |
118
|
|
|
* @param $type |
119
|
|
|
* @throws \Exception |
120
|
|
|
*/ |
121
|
|
|
public function setContactType($type) |
122
|
|
|
{ |
123
|
|
|
$this->appendType('contact:type', $type); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* For contact role 5, <contact:legalemail> is mandatory, for others <contact:email> is mandatory |
128
|
|
|
* |
129
|
|
|
* @param $email |
130
|
|
|
*/ |
131
|
|
|
public function setLegalEmail($email) |
132
|
|
|
{ |
133
|
|
|
$this->appendLegalEmail('contact:legalemail', $email); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function setFirstName($firstName) |
137
|
|
|
{ |
138
|
|
|
$this->appendFirstName('contact:postalInfo[@type=\'%s\']/contact:firstname', $firstName); |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function setLastName($lastName) |
142
|
|
|
{ |
143
|
|
|
$this->appendLastName('contact:postalInfo[@type=\'%s\']/contact:lastname', $lastName); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function setRegisterNumber($number) |
147
|
|
|
{ |
148
|
|
|
$this->appendRegisterNumber('contact:postalInfo[@type=\'%s\']/contact:registernumber', $number); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function setGender($gender) |
152
|
|
|
{ |
153
|
|
|
$this->appendGender('contact:postalInfo[@type=\'%s\']/contact:gender', $gender); |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function setIsFinish($finish) |
157
|
|
|
{ |
158
|
|
|
$this->appendIsFinish('contact:postalInfo[@type=\'%s\']/contact:isfinnish', $finish); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* $frame->setIdentity('123423A123F'); |
163
|
|
|
* $frame->birthDate('2005-04-03T22:00:00.0Z'); |
164
|
|
|
*/ |
165
|
|
|
public function setIdentity($identity) |
166
|
|
|
{ |
167
|
|
|
$this->appendIdentity('contact:postalInfo[@type=\'%s\']/contact:identity', $identity); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function setBirthDate($date) |
171
|
|
|
{ |
172
|
|
|
$this->appendBirthDay('contact:postalInfo[@type=\'%s\']/contact:birthDate', $date); |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|