Completed
Pull Request — master (#67)
by
unknown
01:19
created

Future   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtensionNamespace() 0 4 1
A setFuture() 0 8 2
A setAuthInfo() 0 8 2
A resendConfirmationRequest() 0 4 1
1
<?php
2
3
namespace AfriCC\EPP\Extension\NASK\Transfer;
4
5
use AfriCC\EPP\ExtensionInterface;
6
use AfriCC\EPP\Frame\Command\Transfer as TransferCommand;
7
use AfriCC\EPP\Validator;
8
use Exception;
9
10
class Future extends TransferCommand implements ExtensionInterface
11
{
12
    protected $extension = 'extfut';
13
14
    protected $extension_xmlns = 'http://www.dns.pl/nask-epp-schema/extfut-2.0';
15
16
    public function getExtensionNamespace()
17
    {
18
        return $this->extension_xmlns;
19
    }
20
21
    /**
22
     * Set domain name for future (option)
23
     *
24
     * @param string $domain Domain Name
25
     *
26
     * @throws Exception on incorrect domain name
27
     */
28
    public function setFuture($domain)
29
    {
30
        if (!Validator::isHostname($domain)) {
31
            throw new Exception(sprintf('%s is not a valid domain name', $domain));
32
        }
33
34
        $this->set('future:name', $domain);
35
    }
36
37
    /**
38
     * Set requested future AuthInfo
39
     *
40
     * @param string $pw AuthInfo for future
41
     * @param string $roid if specified, this is ContactId of registrant and autinfo is of registrant
42
     */
43
    public function setAuthInfo($pw, $roid = null)
44
    {
45
        $node = $this->set('future:authInfo/future:pw', $pw);
46
47
        if ($roid !== null) {
48
            $node->setAttribute('roid', $roid);
49
        }
50
    }
51
52
    public function resendConfirmationRequest()
53
    {
54
        $this->set('//epp:epp/epp:command/epp:extension/extfut:transfer/extfut:resendConfirmationRequest');
55
    }
56
}
57