1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the php-epp2 library. |
5
|
|
|
* |
6
|
|
|
* (c) Riccardo Bessone <[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\Extension\NicIT\Create; |
13
|
|
|
|
14
|
|
|
use AfriCC\EPP\ExtensionInterface as Extension; |
15
|
|
|
use AfriCC\EPP\Frame\Command\Create\Contact as ContactCreate; |
16
|
|
|
use AfriCC\EPP\Validator; |
17
|
|
|
use Exception; |
18
|
|
|
|
19
|
|
|
class Contact extends ContactCreate implements Extension |
20
|
|
|
{ |
21
|
|
|
protected $extension = 'extcon'; |
22
|
|
|
protected $extension_xmlns = 'http://www.nic.it/ITNIC-EPP/extcon-1.0'; |
23
|
|
|
|
24
|
|
|
protected static $entityTypes = [ |
25
|
|
|
1, // Italian and foreign natural persons |
26
|
|
|
2, // Companies/one man companie |
27
|
|
|
3, // Freelance workers/professionals |
28
|
|
|
4, // Non-profit organizations |
29
|
|
|
5, // Public organizations |
30
|
|
|
6, // Other subjects |
31
|
|
|
7, // Foreigners who match 2-6 |
32
|
|
|
]; |
33
|
|
|
|
34
|
|
|
public function setConsentForPublishing($consent = false) |
35
|
|
|
{ |
36
|
|
|
$this->set('//epp:epp/epp:command/epp:extension/extcon:create/extcon:consentForPublishing', $consent ? 'true' : 'false'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function setRegistrant($entityType, $nationalityCode = '', $regCode = '') |
40
|
|
|
{ |
41
|
|
|
if (!in_array($entityType, self::$entityTypes)) { |
42
|
|
|
throw new Exception(sprintf('the entity type: \'%s\' is invalid', $entityType)); |
43
|
|
|
} |
44
|
|
|
$this->set('//epp:epp/epp:command/epp:extension/extcon:create/extcon:registrant/extcon:entityType', $entityType); |
45
|
|
|
|
46
|
|
|
if ($nationalityCode != '' && !Validator::isCountryCode($nationalityCode)) { |
47
|
|
|
throw new Exception(sprintf('the country-code: \'%s\' is unknown', $nationalityCode)); |
48
|
|
|
} |
49
|
|
|
$this->set('//epp:epp/epp:command/epp:extension/extcon:create/extcon:registrant/extcon:nationalityCode', $nationalityCode); |
50
|
|
|
|
51
|
|
|
if ($regCode != '') { |
52
|
|
|
$this->set('//epp:epp/epp:command/epp:extension/extcon:create/extcon:registrant/extcon:regCode', $regCode); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|