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

ARBCreateSubscriptionResponse   A

Complexity

Total Complexity 19

Size/Duplication

Total Lines 107
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

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