-
Notifications
You must be signed in to change notification settings - Fork 401
Expand file tree
/
Copy pathARBGetSubscriptionResponse.php
More file actions
94 lines (85 loc) · 2.31 KB
/
Copy pathARBGetSubscriptionResponse.php
File metadata and controls
94 lines (85 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
namespace net\authorize\api\contract\v1;
/**
* Class representing ARBGetSubscriptionResponse
*/
class ARBGetSubscriptionResponse extends ANetApiResponseType
{
/**
* @property \net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription
*/
private $subscription = null;
/**
* Gets as subscription
*
* @return \net\authorize\api\contract\v1\ARBSubscriptionMaskedType
*/
public function getSubscription()
{
return $this->subscription;
}
/**
* Sets a new subscription
*
* @param \net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription
* @return self
*/
public function setSubscription(\net\authorize\api\contract\v1\ARBSubscriptionMaskedType $subscription)
{
$this->subscription = $subscription;
return $this;
}
/**
* Json Set Code
*
* @param $data
* @throws \Exception
*
* @return void
*/
public function set($data)
{
if(is_array($data) || is_object($data)) {
$mapper = \net\authorize\util\Mapper::Instance();
foreach($data AS $key => $value) {
$classDetails = $mapper->getClass(get_class() , $key);
if($classDetails !== NULL ) {
if ($classDetails->isArray) {
if ($classDetails->isCustomDefined) {
foreach($value AS $keyChild => $valueChild) {
$type = new $classDetails->className;
$type->set($valueChild);
$this->{'addTo' . $key}($type);
}
}
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
foreach($value AS $keyChild => $valueChild) {
$type = new \DateTime($valueChild);
$this->{'addTo' . $key}($type);
}
}
else {
foreach($value AS $keyChild => $valueChild) {
$this->{'addTo' . $key}($valueChild);
}
}
}
else {
if ($classDetails->isCustomDefined){
$type = new $classDetails->className;
$type->set($value);
$this->{'set' . $key}($type);
}
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
$type = new \DateTime($value);
$this->{'set' . $key}($type);
}
else {
$this->{'set' . $key}($value);
}
}
}
}
}
}
}