1: | <?php |
2: | |
3: | |
4: | |
5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
6: | |
7: | use UnexpectedValueException; |
8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
9: | |
10: | |
11: | |
12: | |
13: | class PlainCardData extends DataObject |
14: | { |
15: | |
16: | |
17: | |
18: | public $cardNumber = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $cardSecurityCode = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $expiryDate = null; |
29: | |
30: | |
31: | |
32: | |
33: | public function toObject() |
34: | { |
35: | $object = parent::toObject(); |
36: | if (!is_null($this->cardNumber)) { |
37: | $object->cardNumber = $this->cardNumber; |
38: | } |
39: | if (!is_null($this->cardSecurityCode)) { |
40: | $object->cardSecurityCode = $this->cardSecurityCode; |
41: | } |
42: | if (!is_null($this->expiryDate)) { |
43: | $object->expiryDate = $this->expiryDate; |
44: | } |
45: | return $object; |
46: | } |
47: | |
48: | |
49: | |
50: | |
51: | |
52: | |
53: | public function fromObject($object) |
54: | { |
55: | parent::fromObject($object); |
56: | if (property_exists($object, 'cardNumber')) { |
57: | $this->cardNumber = $object->cardNumber; |
58: | } |
59: | if (property_exists($object, 'cardSecurityCode')) { |
60: | $this->cardSecurityCode = $object->cardSecurityCode; |
61: | } |
62: | if (property_exists($object, 'expiryDate')) { |
63: | $this->expiryDate = $object->expiryDate; |
64: | } |
65: | return $this; |
66: | } |
67: | } |
68: | |