Completed
Push — master ( 9ebe33...7fa78e )
by Kaushik
52:50 queued 23:00
created

UpdateMerchantDetailsRequest   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 2
dl 0
loc 67
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIsTestMode() 0 4 1
A setIsTestMode() 0 5 1
B jsonSerialize() 0 33 8
1
<?php
2
3
namespace net\authorize\api\contract\v1;
4
5
/**
6
 * Class representing UpdateMerchantDetailsRequest
7
 */
8
class UpdateMerchantDetailsRequest extends ANetApiRequestType
9
{
10
11
    /**
12
     * @property boolean $isTestMode
13
     */
14
    private $isTestMode = null;
15
16
    /**
17
     * Gets as isTestMode
18
     *
19
     * @return boolean
20
     */
21
    public function getIsTestMode()
22
    {
23
        return $this->isTestMode;
24
    }
25
26
    /**
27
     * Sets a new isTestMode
28
     *
29
     * @param boolean $isTestMode
30
     * @return self
31
     */
32
    public function setIsTestMode($isTestMode)
33
    {
34
        $this->isTestMode = $isTestMode;
35
        return $this;
36
    }
37
38
39
    // Json Serialize Code
40
    public function jsonSerialize(){
41
        $values = array_filter((array)get_object_vars($this),
42
        function ($val){
43
            return !is_null($val);
44
        });
45
        $mapper = \net\authorize\util\Mapper::Instance();
46
        foreach($values as $key => $value){
47
            $classDetails = $mapper->getClass(get_class() , $key);
48
            if (isset($value)){
49
                if ($classDetails->className === 'Date'){
50
                    $dateTime = $value->format('Y-m-d');
51
                    $values[$key] = $dateTime;
52
                }
53
                else if ($classDetails->className === 'DateTime'){
54
                    $dateTime = $value->format('Y-m-d\TH:i:s\Z');
55
                    $values[$key] = $dateTime;
56
                }
57
                if (is_array($value)){
58
                    if (!$classDetails->isInlineArray){
59
                        $subKey = $classDetails->arrayEntryname;
60
                        $subArray = [$subKey => $value];
61
                        $values[$key] = $subArray;
62
                    }
63
                }
64
            }
65
        }
66
        if (get_parent_class() == ""){
67
            return $values;
68
        }
69
        else{
70
            return array_merge(parent::jsonSerialize(), $values);
71
        }
72
    }
73
    
74
}
75
76