Completed
Push — master ( 9ebe33 )
by Kaushik
28:24
created

GetTransactionListResponse   A

Complexity

Total Complexity 22

Size/Duplication

Total Lines 141
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A addToTransactions() 0 5 1
A issetTransactions() 0 4 1
A unsetTransactions() 0 4 1
A getTransactions() 0 4 1
A setTransactions() 0 5 1
A getTotalNumInResultSet() 0 4 1
A setTotalNumInResultSet() 0 5 1
C set() 0 46 15
1
<?php
2
3
namespace net\authorize\api\contract\v1;
4
5
/**
6
 * Class representing GetTransactionListResponse
7
 */
8
class GetTransactionListResponse extends ANetApiResponseType
9
{
10
11
    /**
12
     * @property \net\authorize\api\contract\v1\TransactionSummaryType[] $transactions
13
     */
14
    private $transactions = null;
15
16
    /**
17
     * @property integer $totalNumInResultSet
18
     */
19
    private $totalNumInResultSet = null;
20
21
    /**
22
     * Adds as transaction
23
     *
24
     * @return self
25
     * @param \net\authorize\api\contract\v1\TransactionSummaryType $transaction
26
     */
27
    public function addToTransactions(\net\authorize\api\contract\v1\TransactionSummaryType $transaction)
28
    {
29
        $this->transactions[] = $transaction;
30
        return $this;
31
    }
32
33
    /**
34
     * isset transactions
35
     *
36
     * @param scalar $index
37
     * @return boolean
38
     */
39
    public function issetTransactions($index)
40
    {
41
        return isset($this->transactions[$index]);
42
    }
43
44
    /**
45
     * unset transactions
46
     *
47
     * @param scalar $index
48
     * @return void
49
     */
50
    public function unsetTransactions($index)
51
    {
52
        unset($this->transactions[$index]);
53
    }
54
55
    /**
56
     * Gets as transactions
57
     *
58
     * @return \net\authorize\api\contract\v1\TransactionSummaryType[]
59
     */
60
    public function getTransactions()
61
    {
62
        return $this->transactions;
63
    }
64
65
    /**
66
     * Sets a new transactions
67
     *
68
     * @param \net\authorize\api\contract\v1\TransactionSummaryType[] $transactions
69
     * @return self
70
     */
71
    public function setTransactions(array $transactions)
72
    {
73
        $this->transactions = $transactions;
74
        return $this;
75
    }
76
77
    /**
78
     * Gets as totalNumInResultSet
79
     *
80
     * @return integer
81
     */
82
    public function getTotalNumInResultSet()
83
    {
84
        return $this->totalNumInResultSet;
85
    }
86
87
    /**
88
     * Sets a new totalNumInResultSet
89
     *
90
     * @param integer $totalNumInResultSet
91
     * @return self
92
     */
93
    public function setTotalNumInResultSet($totalNumInResultSet)
94
    {
95
        $this->totalNumInResultSet = $totalNumInResultSet;
96
        return $this;
97
    }
98
99
100
    // Json Set Code
101
    public function set($data)
102
    {
103
        if(is_array($data) || is_object($data)) {
104
			$mapper = \net\authorize\util\Mapper::Instance();
105
			foreach($data AS $key => $value) {
106
				$classDetails = $mapper->getClass(get_class() , $key);
107
	 
108
				if($classDetails !== NULL ) {
109
					if ($classDetails->isArray) {
110
						if ($classDetails->isCustomDefined) {
111
							foreach($value AS $keyChild => $valueChild) {
112
								$type = new $classDetails->className;
113
								$type->set($valueChild);
114
								$this->{'addTo' . $key}($type);
115
							}
116
						}
117
						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
118
							foreach($value AS $keyChild => $valueChild) {
119
								$type = new \DateTime($valueChild);
120
								$this->{'addTo' . $key}($type);
121
							}
122
						}
123
						else {
124
							foreach($value AS $keyChild => $valueChild) {
125
								$this->{'addTo' . $key}($valueChild);
126
							}
127
						}
128
					}
129
					else {
130
						if ($classDetails->isCustomDefined){
131
							$type = new $classDetails->className;
132
							$type->set($value);
133
							$this->{'set' . $key}($type);
134
						}
135
						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
136
							$type = new \DateTime($value);
137
							$this->{'set' . $key}($type);
138
						}
139
						else {
140
							$this->{'set' . $key}($value);
141
						}
142
					}
143
				}
144
			}
145
		}
146
    }
147
    
148
}
149
150