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

GetSettledBatchListResponse   A

Complexity

Total Complexity 20

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

6 Methods

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