Completed
Pull Request — master (#67)
by
unknown
01:33
created

Domain   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

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