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