Domain   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 79
rs 10
c 0
b 0
f 0

5 Methods

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