Completed
Push — master ( 3b3aeb...14bab3 )
by
unknown
01:16
created

Future::setFuture()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace AfriCC\EPP\Extension\NASK\Info;
4
5
use AfriCC\EPP\Frame\Command\Info as InfoCommand;
6
use AfriCC\EPP\Validator;
7
use Exception;
8
9
class Future extends InfoCommand
10
{
11
    /**
12
     * Set domain name for future (option)
13
     *
14
     * @param string $domain Domain Name
15
     *
16
     * @throws Exception on incorrect domain name
17
     */
18
    public function setFuture($domain)
19
    {
20
        if (!Validator::isHostname($domain)) {
21
            throw new Exception(sprintf('%s is not a valid domain name', $domain));
22
        }
23
24
        $this->set('future:name', $domain);
25
    }
26
27
    /**
28
     * Set requested future AuthInfo
29
     *
30
     * @param string $pw AuthInfo for future
31
     * @param string $roid if specified, this is ContactId of registrant and autinfo is of registrant
32
     */
33
    public function setAuthInfo($pw, $roid = null)
34
    {
35
        $node = $this->set('future:authInfo/future:pw', $pw);
36
37
        if ($roid !== null) {
38
            $node->setAttribute('roid', $roid);
39
        }
40
    }
41
}
42