Cache.php
120 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @copyright © TMS-Plugins. All rights reserved. |
| 4 | * @licence See LICENCE.md for license details. |
| 5 | */ |
| 6 | |
| 7 | namespace AmeliaBooking\Domain\Entity\Cache; |
| 8 | |
| 9 | use AmeliaBooking\Domain\ValueObjects\Json; |
| 10 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 11 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 12 | |
| 13 | /** |
| 14 | * Class Cache |
| 15 | * |
| 16 | * @package AmeliaBooking\Domain\Entity\Cache |
| 17 | */ |
| 18 | class Cache |
| 19 | { |
| 20 | /** @var Id */ |
| 21 | private $id; |
| 22 | |
| 23 | /** @var Name */ |
| 24 | private $name; |
| 25 | |
| 26 | /** @var Id */ |
| 27 | private $paymentId; |
| 28 | |
| 29 | /** @var Json */ |
| 30 | protected $data; |
| 31 | |
| 32 | /** |
| 33 | * Cache constructor. |
| 34 | * |
| 35 | * @param Name $name |
| 36 | */ |
| 37 | public function __construct( |
| 38 | Name $name |
| 39 | ) { |
| 40 | $this->name = $name; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @return Id |
| 45 | */ |
| 46 | public function getId() |
| 47 | { |
| 48 | return $this->id; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * @param Id $id |
| 53 | */ |
| 54 | public function setId($id) |
| 55 | { |
| 56 | $this->id = $id; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @return Name |
| 61 | */ |
| 62 | public function getName() |
| 63 | { |
| 64 | return $this->name; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @param Name $name |
| 69 | */ |
| 70 | public function setName($name) |
| 71 | { |
| 72 | $this->name = $name; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return Id |
| 77 | */ |
| 78 | public function getPaymentId() |
| 79 | { |
| 80 | return $this->paymentId; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @param Id $paymentId |
| 85 | */ |
| 86 | public function setPaymentId($paymentId) |
| 87 | { |
| 88 | $this->paymentId = $paymentId; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @return Json |
| 93 | */ |
| 94 | public function getData() |
| 95 | { |
| 96 | return $this->data; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @param Json $data |
| 101 | */ |
| 102 | public function setData(Json $data) |
| 103 | { |
| 104 | $this->data = $data; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @return array |
| 109 | */ |
| 110 | public function toArray() |
| 111 | { |
| 112 | return [ |
| 113 | 'id' => $this->getId() ? $this->getId()->getValue() : null, |
| 114 | 'name' => $this->getName()->getValue(), |
| 115 | 'paymentId' => $this->getPaymentId() ? $this->getPaymentId()->getValue() : null, |
| 116 | 'data' => $this->getData() ? $this->getData()->getValue() : null, |
| 117 | ]; |
| 118 | } |
| 119 | } |
| 120 |