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

Future::setCurrentExpirationDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace AfriCC\EPP\Extension\NASK\Renew;
4
5
use AfriCC\EPP\Frame\Command\Renew as RenewCommand;
6
use AfriCC\EPP\PeriodTrait;
7
use AfriCC\EPP\Validator;
8
use Exception;
9
10
class Future extends RenewCommand
11
{
12
    use PeriodTrait;
13
14
    /**
15
     * Set domain name for future (option)
16
     *
17
     * @param string $domain Domain Name
18
     *
19
     * @throws Exception on incorrect domain name
20
     */
21
    public function setFuture($domain)
22
    {
23
        if (!Validator::isHostname($domain)) {
24
            throw new Exception(sprintf('%s is not a valid domain name', $domain));
25
        }
26
27
        $this->set('future:name', $domain);
28
    }
29
30
    /**
31
     * Set current expiration date of future object
32
     *
33
     * @param string $curExpDate date in yyyy-mm-dd format
34
     */
35
    public function setCurrentExpirationDate($curExpDate)
36
    {
37
        $this->set('future:curExpDate', $curExpDate);
38
    }
39
40
    /**
41
     * Set renew period for future object
42
     *
43
     * Usually this should be 3y.
44
     *
45
     * @param string $period ending in y (for years) or m (for months)
46
     */
47
    public function setPeriod($period)
48
    {
49
        $this->appendPeriod('future:period[@unit=\'%s\']', $period);
50
    }
51
}
52