PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / Bookable / AbstractExtra.php
ameliabooking / src / Domain / Entity / Bookable Last commit date
Service 6 months ago AbstractBookable.php 2 months ago AbstractCategory.php 6 months ago AbstractExtra.php 1 year ago
AbstractExtra.php
154 lines
1 <?php
2
3 namespace AmeliaBooking\Domain\Entity\Bookable;
4
5 use AmeliaBooking\Domain\ValueObjects\Number\Float\Price;
6 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
7 use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger;
8 use AmeliaBooking\Domain\ValueObjects\String\BookableType;
9 use AmeliaBooking\Domain\ValueObjects\String\Description;
10 use AmeliaBooking\Domain\ValueObjects\String\Name;
11
12 /**
13 * Class AbstractExtra
14 *
15 * @package AmeliaBooking\Domain\Entity\Bookable
16 */
17 abstract class AbstractExtra
18 {
19 /** @var Id */
20 private $id;
21
22 /** @var Name */
23 protected $name;
24
25 /** @var Description */
26 protected $description;
27
28 /** @var Price */
29 protected $price;
30
31 /** @var PositiveInteger */
32 protected $maxQuantity;
33
34 /** @var PositiveInteger */
35 protected $position;
36
37 /**
38 * @return Id
39 */
40 public function getId()
41 {
42 return $this->id;
43 }
44
45 /**
46 * @param Id $id
47 */
48 public function setId(Id $id)
49 {
50 $this->id = $id;
51 }
52
53 /**
54 * @return Name
55 */
56 public function getName()
57 {
58 return $this->name;
59 }
60
61 /**
62 * @param Name $name
63 */
64 public function setName(Name $name)
65 {
66 $this->name = $name;
67 }
68
69 /**
70 * @return Description
71 */
72 public function getDescription()
73 {
74 return $this->description;
75 }
76
77 /**
78 * @param Description $description
79 */
80 public function setDescription(Description $description)
81 {
82 $this->description = $description;
83 }
84
85 /**
86 * @return Price
87 */
88 public function getPrice()
89 {
90 return $this->price;
91 }
92
93 /**
94 * @param Price $price
95 */
96 public function setPrice(Price $price)
97 {
98 $this->price = $price;
99 }
100
101 /**
102 * @return PositiveInteger
103 */
104 public function getMaxQuantity()
105 {
106 return $this->maxQuantity;
107 }
108
109 /**
110 * @param PositiveInteger $maxQuantity
111 */
112 public function setMaxQuantity(PositiveInteger $maxQuantity)
113 {
114 $this->maxQuantity = $maxQuantity;
115 }
116
117 /**
118 * @return PositiveInteger
119 */
120 public function getPosition()
121 {
122 return $this->position;
123 }
124
125 /**
126 * @param PositiveInteger $position
127 */
128 public function setPosition(PositiveInteger $position)
129 {
130 $this->position = $position;
131 }
132
133 /**
134 * @return BookableType
135 */
136 abstract public function getType();
137
138 /**
139 * @return array
140 */
141 public function toArray()
142 {
143 return [
144 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
145 'name' => $this->getName() ? $this->getName()->getValue() : null,
146 'description' => $this->getDescription() ? $this->getDescription()->getValue() : null,
147 'price' => $this->getPrice() ? $this->getPrice()->getValue() : null,
148 'maxQuantity' => $this->getMaxQuantity() ? $this->getMaxQuantity()->getValue() : null,
149 'position' => $this->getPosition() ? $this->getPosition()->getValue() : null,
150 'type' => $this->getType() ? $this->getType()->getValue() : null,
151 ];
152 }
153 }
154