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