PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / vendor / square / square / src / Legacy / Models / Availability.php

Availability.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Legacy/Models/Availability.php

146 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Defines an appointment slot that encapsulates the appointment segments, location and starting time
11 * available for booking.
12 */
13 class Availability implements \JsonSerializable
14 {
15 /**
16 * @var array
17 */
18 private $startAt = [];
19
20 /**
21 * @var string|null
22 */
23 private $locationId;
24
25 /**
26 * @var array
27 */
28 private $appointmentSegments = [];
29
30 /**
31 * Returns Start At.
32 * The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
33 */
34 public function getStartAt(): ?string
35 {
36 if (count($this->startAt) == 0) {
37 return null;
38 }
39 return $this->startAt['value'];
40 }
41
42 /**
43 * Sets Start At.
44 * The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
45 *
46 * @maps start_at
47 */
48 public function setStartAt(?string $startAt): void
49 {
50 $this->startAt['value'] = $startAt;
51 }
52
53 /**
54 * Unsets Start At.
55 * The RFC 3339 timestamp specifying the beginning time of the slot available for booking.
56 */
57 public function unsetStartAt(): void
58 {
59 $this->startAt = [];
60 }
61
62 /**
63 * Returns Location Id.
64 * The ID of the location available for booking.
65 */
66 public function getLocationId(): ?string
67 {
68 return $this->locationId;
69 }
70
71 /**
72 * Sets Location Id.
73 * The ID of the location available for booking.
74 *
75 * @maps location_id
76 */
77 public function setLocationId(?string $locationId): void
78 {
79 $this->locationId = $locationId;
80 }
81
82 /**
83 * Returns Appointment Segments.
84 * The list of appointment segments available for booking
85 *
86 * @return AppointmentSegment[]|null
87 */
88 public function getAppointmentSegments(): ?array
89 {
90 if (count($this->appointmentSegments) == 0) {
91 return null;
92 }
93 return $this->appointmentSegments['value'];
94 }
95
96 /**
97 * Sets Appointment Segments.
98 * The list of appointment segments available for booking
99 *
100 * @maps appointment_segments
101 *
102 * @param AppointmentSegment[]|null $appointmentSegments
103 */
104 public function setAppointmentSegments(?array $appointmentSegments): void
105 {
106 $this->appointmentSegments['value'] = $appointmentSegments;
107 }
108
109 /**
110 * Unsets Appointment Segments.
111 * The list of appointment segments available for booking
112 */
113 public function unsetAppointmentSegments(): void
114 {
115 $this->appointmentSegments = [];
116 }
117
118 /**
119 * Encode this object to JSON
120 *
121 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
122 * are set. (default: false)
123 *
124 * @return array|stdClass
125 */
126 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
127 public function jsonSerialize(bool $asArrayWhenEmpty = false)
128 {
129 $json = [];
130 if (!empty($this->startAt)) {
131 $json['start_at'] = $this->startAt['value'];
132 }
133 if (isset($this->locationId)) {
134 $json['location_id'] = $this->locationId;
135 }
136 if (!empty($this->appointmentSegments)) {
137 $json['appointment_segments'] = $this->appointmentSegments['value'];
138 }
139 $json = array_filter($json, function ($val) {
140 return $val !== null;
141 });
142
143 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
144 }
145 }
146