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