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 / Service / Extra.php
ameliabooking / src / Domain / Entity / Bookable / Service Last commit date
Category.php 1 year ago Extra.php 1 year ago Package.php 6 months ago PackageCustomer.php 6 months ago PackageCustomerService.php 6 months ago PackageService.php 6 months ago Resource.php 6 months ago Service.php 6 months ago
Extra.php
120 lines
1 <?php
2
3 namespace AmeliaBooking\Domain\Entity\Bookable\Service;
4
5 use AmeliaBooking\Domain\Entity\Bookable\AbstractExtra;
6 use AmeliaBooking\Domain\Entity\Entities;
7 use AmeliaBooking\Domain\ValueObjects\BooleanValueObject;
8 use AmeliaBooking\Domain\ValueObjects\Json;
9 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
10 use AmeliaBooking\Domain\ValueObjects\Duration;
11 use AmeliaBooking\Domain\ValueObjects\String\BookableType;
12
13 /**
14 * Class Extra
15 *
16 * @package AmeliaBooking\Domain\Entity\Bookable\Service
17 */
18 class Extra extends AbstractExtra
19 {
20 /** @var Duration */
21 private $duration;
22
23 /** @var Id */
24 private $serviceId;
25
26 /** @var BooleanValueObject */
27 protected $aggregatedPrice;
28
29 /** @var Json */
30 private $translations;
31
32 /**
33 * @return Duration
34 */
35 public function getDuration()
36 {
37 return $this->duration;
38 }
39
40 /**
41 * @param Duration $duration
42 */
43 public function setDuration(Duration $duration)
44 {
45 $this->duration = $duration;
46 }
47
48 /**
49 * @return Id
50 */
51 public function getServiceId()
52 {
53 return $this->serviceId;
54 }
55
56 /**
57 * @param Id $serviceId
58 */
59 public function setServiceId(Id $serviceId)
60 {
61 $this->serviceId = $serviceId;
62 }
63
64 /**
65 * @return BooleanValueObject
66 */
67 public function getAggregatedPrice()
68 {
69 return $this->aggregatedPrice;
70 }
71
72 /**
73 * @param BooleanValueObject $aggregatedPrice
74 */
75 public function setAggregatedPrice(BooleanValueObject $aggregatedPrice)
76 {
77 $this->aggregatedPrice = $aggregatedPrice;
78 }
79
80 /**
81 * @return Json
82 */
83 public function getTranslations()
84 {
85 return $this->translations;
86 }
87
88 /**
89 * @param Json $translations
90 */
91 public function setTranslations(Json $translations)
92 {
93 $this->translations = $translations;
94 }
95
96 /**
97 * @return BookableType
98 */
99 public function getType()
100 {
101 return new BookableType(Entities::EXTRA);
102 }
103
104 /**
105 * @return array
106 */
107 public function toArray()
108 {
109 return array_merge(
110 parent::toArray(),
111 [
112 'duration' => $this->getDuration() ? $this->getDuration()->getValue() : null,
113 'serviceId' => $this->getServiceId() ? $this->getServiceId()->getValue() : null,
114 'aggregatedPrice' => $this->getAggregatedPrice() ? $this->getAggregatedPrice()->getValue() : null,
115 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
116 ]
117 );
118 }
119 }
120