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

DeleteCustomerShippingAddressResponse   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
C set() 0 46 15
1
<?php
2
3
namespace net\authorize\api\contract\v1;
4
5
/**
6
 * Class representing DeleteCustomerShippingAddressResponse
7
 */
8
class DeleteCustomerShippingAddressResponse extends ANetApiResponseType
9
{
10
11
12
    // Json Set Code
13
    public function set($data)
14
    {
15
        if(is_array($data) || is_object($data)) {
16
			$mapper = \net\authorize\util\Mapper::Instance();
17
			foreach($data AS $key => $value) {
18
				$classDetails = $mapper->getClass(get_class() , $key);
19
	 
20
				if($classDetails !== NULL ) {
21
					if ($classDetails->isArray) {
22
						if ($classDetails->isCustomDefined) {
23
							foreach($value AS $keyChild => $valueChild) {
24
								$type = new $classDetails->className;
25
								$type->set($valueChild);
26
								$this->{'addTo' . $key}($type);
27
							}
28
						}
29
						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
30
							foreach($value AS $keyChild => $valueChild) {
31
								$type = new \DateTime($valueChild);
32
								$this->{'addTo' . $key}($type);
33
							}
34
						}
35
						else {
36
							foreach($value AS $keyChild => $valueChild) {
37
								$this->{'addTo' . $key}($valueChild);
38
							}
39
						}
40
					}
41
					else {
42
						if ($classDetails->isCustomDefined){
43
							$type = new $classDetails->className;
44
							$type->set($value);
45
							$this->{'set' . $key}($type);
46
						}
47
						else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
48
							$type = new \DateTime($value);
49
							$this->{'set' . $key}($type);
50
						}
51
						else {
52
							$this->{'set' . $key}($value);
53
						}
54
					}
55
				}
56
			}
57
		}
58
    }
59
    
60
}
61
62