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

Domain::setState()   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\Report;
4
5
use AfriCC\EPP\Extension\NASK\Report;
6
7
class Domain extends Report
8
{
9
    /**
10
     * Init Domains Report frame
11
     */
12
    public function __construct()
13
    {
14
        parent::__construct();
15
        $this->set('extreport:domain');
16
    }
17
18
    /**
19
     * Set Domains state to report about
20
     *
21
     * Acceptable states are:
22
     * <ul>
23
     *     <li> STATE_REGISTERED</li>
24
     *     <li> STATE_EXPIRED</li>
25
     *     <li> STATE_BLOCKED</li>
26
     *     <li> STATE_RESERVED</li>
27
     *     <li> STATE_BOOK_BLOCKED</li>
28
     *     <li> STATE_DELETE_BLOCKED</li>
29
     * </ul>
30
     *
31
     * If not set default is assumed STATE_REGISTERED
32
     *
33
     * @param string $state
34
     */
35
    public function setState($state)
36
    {
37
        $this->set('extreport:domain/extreport:state', $state);
38
    }
39
40
    /**
41
     * Set expiry date of domain state.
42
     *
43
     * Do not use this if intended report is to be about all domains.
44
     *
45
     * @param string $date in proper format
46
     */
47
    public function setExDate($date)
48
    {
49
        $this->set('extreport:domain/extreport:exDate', $date);
50
    }
51
52
    /**
53
     * Add domain status to list of statuses of domains to include in report
54
     *
55
     * Depending on value of statusesIn, domains in report will either have or not have specified statuses.
56
     *
57
     * @see Domain::setStatusesIn()
58
     *
59
     * @param string $status domain status
60
     */
61
    public function addStatus($status)
62
    {
63
        $this->set('extreport:domain/extreport:statuses/extreport:status[]', $status);
64
    }
65
66
    /**
67
     * Set statutesIn attribute of statuses select.
68
     *
69
     * If set to true, report will include domains having specified statuses.
70
     * Otherwise report will include domains <b>not</b> having specified statuses.
71
     *
72
     * By default registrar assumes true for statusesIn
73
     *
74
     * @see Domain::addStatus();
75
     *
76
     * @param bool $statusesIn
77
     */
78
    public function setStatusesIn($statusesIn = true)
79
    {
80
        $node = $this->set('extreport:domain/extreport:statuses');
81
82
        $node->setAttribute('statusesIn', ($statusesIn) ? 'true' : 'false');
83
    }
84
}
85