Completed
Pull Request — master (#67)
by
unknown
01:33
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
namespace AfriCC\EPP\Extension\NASK\Info;
3
4
use AfriCC\EPP\Frame\Command\Info as InfoCommand;
5
use AfriCC\EPP\Validator;
6
use Exception;
7
8
class Future extends InfoCommand
9
{
10
    /**
11
     * Set domain name for future (option)
12
     *
13
     * @param string $domain Domain Name
14
     *
15
     * @throws Exception on incorrect domain name
16
     */
17
    public function setFuture($domain)
18
    {
19
        if (!Validator::isHostname($domain)) {
20
            throw new Exception(sprintf('%s is not a valid domain name', $domain));
21
        }
22
23
        $this->set('future:name', $domain);
24
    }
25
26
    /**
27
     * Set requested future AuthInfo
28
     *
29
     * @param string $pw AuthInfo for future
30
     * @param string $roid if specified, this is ContactId of registrant and autinfo is of registrant
31
     */
32
    public function setAuthInfo($pw, $roid = null)
33
    {
34
        $node = $this->set('future:authInfo/future:pw', $pw);
35
36
        if ($roid !== null) {
37
            $node->setAttribute('roid', $roid);
38
        }
39
    }
40
}
41
42