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 TrialInformation extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $amountOfMoneyAfterTrial = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $endDate = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $isRecurring = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $trialPeriod = null; |
35: | |
36: | |
37: | |
38: | |
39: | public $trialPeriodRecurring = null; |
40: | |
41: | |
42: | |
43: | |
44: | public function toObject() |
45: | { |
46: | $object = parent::toObject(); |
47: | if (!is_null($this->amountOfMoneyAfterTrial)) { |
48: | $object->amountOfMoneyAfterTrial = $this->amountOfMoneyAfterTrial->toObject(); |
49: | } |
50: | if (!is_null($this->endDate)) { |
51: | $object->endDate = $this->endDate; |
52: | } |
53: | if (!is_null($this->isRecurring)) { |
54: | $object->isRecurring = $this->isRecurring; |
55: | } |
56: | if (!is_null($this->trialPeriod)) { |
57: | $object->trialPeriod = $this->trialPeriod->toObject(); |
58: | } |
59: | if (!is_null($this->trialPeriodRecurring)) { |
60: | $object->trialPeriodRecurring = $this->trialPeriodRecurring->toObject(); |
61: | } |
62: | return $object; |
63: | } |
64: | |
65: | |
66: | |
67: | |
68: | |
69: | |
70: | public function fromObject($object) |
71: | { |
72: | parent::fromObject($object); |
73: | if (property_exists($object, 'amountOfMoneyAfterTrial')) { |
74: | if (!is_object($object->amountOfMoneyAfterTrial)) { |
75: | throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoneyAfterTrial, true) . '\' is not an object'); |
76: | } |
77: | $value = new AmountOfMoney(); |
78: | $this->amountOfMoneyAfterTrial = $value->fromObject($object->amountOfMoneyAfterTrial); |
79: | } |
80: | if (property_exists($object, 'endDate')) { |
81: | $this->endDate = $object->endDate; |
82: | } |
83: | if (property_exists($object, 'isRecurring')) { |
84: | $this->isRecurring = $object->isRecurring; |
85: | } |
86: | if (property_exists($object, 'trialPeriod')) { |
87: | if (!is_object($object->trialPeriod)) { |
88: | throw new UnexpectedValueException('value \'' . print_r($object->trialPeriod, true) . '\' is not an object'); |
89: | } |
90: | $value = new TrialPeriod(); |
91: | $this->trialPeriod = $value->fromObject($object->trialPeriod); |
92: | } |
93: | if (property_exists($object, 'trialPeriodRecurring')) { |
94: | if (!is_object($object->trialPeriodRecurring)) { |
95: | throw new UnexpectedValueException('value \'' . print_r($object->trialPeriodRecurring, true) . '\' is not an object'); |
96: | } |
97: | $value = new Frequency(); |
98: | $this->trialPeriodRecurring = $value->fromObject($object->trialPeriodRecurring); |
99: | } |
100: | return $this; |
101: | } |
102: | } |
103: | |