1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class CybersourceDecisionManager extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $clauseName = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $fraudScore = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $policyApplied = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $reasonCodes = null; |
35: | |
36: | |
37: | |
38: | |
39: | public function toObject() |
40: | { |
41: | $object = parent::toObject(); |
42: | if (!is_null($this->clauseName)) { |
43: | $object->clauseName = $this->clauseName; |
44: | } |
45: | if (!is_null($this->fraudScore)) { |
46: | $object->fraudScore = $this->fraudScore; |
47: | } |
48: | if (!is_null($this->policyApplied)) { |
49: | $object->policyApplied = $this->policyApplied; |
50: | } |
51: | if (!is_null($this->reasonCodes)) { |
52: | $object->reasonCodes = []; |
53: | foreach ($this->reasonCodes as $element) { |
54: | if (!is_null($element)) { |
55: | $object->reasonCodes[] = $element; |
56: | } |
57: | } |
58: | } |
59: | return $object; |
60: | } |
61: | |
62: | |
63: | |
64: | |
65: | |
66: | |
67: | public function fromObject($object) |
68: | { |
69: | parent::fromObject($object); |
70: | if (property_exists($object, 'clauseName')) { |
71: | $this->clauseName = $object->clauseName; |
72: | } |
73: | if (property_exists($object, 'fraudScore')) { |
74: | $this->fraudScore = $object->fraudScore; |
75: | } |
76: | if (property_exists($object, 'policyApplied')) { |
77: | $this->policyApplied = $object->policyApplied; |
78: | } |
79: | if (property_exists($object, 'reasonCodes')) { |
80: | if (!is_array($object->reasonCodes) && !is_object($object->reasonCodes)) { |
81: | throw new UnexpectedValueException('value \'' . print_r($object->reasonCodes, true) . '\' is not an array or object'); |
82: | } |
83: | $this->reasonCodes = []; |
84: | foreach ($object->reasonCodes as $element) { |
85: | $this->reasonCodes[] = $element; |
86: | } |
87: | } |
88: | return $this; |
89: | } |
90: | } |
91: | |