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 / Shift.php

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

533 lines 13.3 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 * A record of the hourly rate, start, and end times for a single work shift
11 * for an employee. This might include a record of the start and end times for breaks
12 * taken during the shift.
13 */
14 class Shift implements \JsonSerializable
15 {
16 /**
17 * @var string|null
18 */
19 private $id;
20
21 /**
22 * @var array
23 */
24 private $employeeId = [];
25
26 /**
27 * @var string
28 */
29 private $locationId;
30
31 /**
32 * @var array
33 */
34 private $timezone = [];
35
36 /**
37 * @var string
38 */
39 private $startAt;
40
41 /**
42 * @var array
43 */
44 private $endAt = [];
45
46 /**
47 * @var ShiftWage|null
48 */
49 private $wage;
50
51 /**
52 * @var array
53 */
54 private $breaks = [];
55
56 /**
57 * @var string|null
58 */
59 private $status;
60
61 /**
62 * @var int|null
63 */
64 private $version;
65
66 /**
67 * @var string|null
68 */
69 private $createdAt;
70
71 /**
72 * @var string|null
73 */
74 private $updatedAt;
75
76 /**
77 * @var array
78 */
79 private $teamMemberId = [];
80
81 /**
82 * @var Money|null
83 */
84 private $declaredCashTipMoney;
85
86 /**
87 * @param string $locationId
88 * @param string $startAt
89 */
90 public function __construct(string $locationId, string $startAt)
91 {
92 $this->locationId = $locationId;
93 $this->startAt = $startAt;
94 }
95
96 /**
97 * Returns Id.
98 * The UUID for this object.
99 */
100 public function getId(): ?string
101 {
102 return $this->id;
103 }
104
105 /**
106 * Sets Id.
107 * The UUID for this object.
108 *
109 * @maps id
110 */
111 public function setId(?string $id): void
112 {
113 $this->id = $id;
114 }
115
116 /**
117 * Returns Employee Id.
118 * The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id`
119 * instead.
120 */
121 public function getEmployeeId(): ?string
122 {
123 if (count($this->employeeId) == 0) {
124 return null;
125 }
126 return $this->employeeId['value'];
127 }
128
129 /**
130 * Sets Employee Id.
131 * The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id`
132 * instead.
133 *
134 * @maps employee_id
135 */
136 public function setEmployeeId(?string $employeeId): void
137 {
138 $this->employeeId['value'] = $employeeId;
139 }
140
141 /**
142 * Unsets Employee Id.
143 * The ID of the employee this shift belongs to. DEPRECATED at version 2020-08-26. Use `team_member_id`
144 * instead.
145 */
146 public function unsetEmployeeId(): void
147 {
148 $this->employeeId = [];
149 }
150
151 /**
152 * Returns Location Id.
153 * The ID of the location this shift occurred at. The location should be based on
154 * where the employee clocked in.
155 */
156 public function getLocationId(): string
157 {
158 return $this->locationId;
159 }
160
161 /**
162 * Sets Location Id.
163 * The ID of the location this shift occurred at. The location should be based on
164 * where the employee clocked in.
165 *
166 * @required
167 * @maps location_id
168 */
169 public function setLocationId(string $locationId): void
170 {
171 $this->locationId = $locationId;
172 }
173
174 /**
175 * Returns Timezone.
176 * The read-only convenience value that is calculated from the location based
177 * on the `location_id`. Format: the IANA timezone database identifier for the
178 * location timezone.
179 */
180 public function getTimezone(): ?string
181 {
182 if (count($this->timezone) == 0) {
183 return null;
184 }
185 return $this->timezone['value'];
186 }
187
188 /**
189 * Sets Timezone.
190 * The read-only convenience value that is calculated from the location based
191 * on the `location_id`. Format: the IANA timezone database identifier for the
192 * location timezone.
193 *
194 * @maps timezone
195 */
196 public function setTimezone(?string $timezone): void
197 {
198 $this->timezone['value'] = $timezone;
199 }
200
201 /**
202 * Unsets Timezone.
203 * The read-only convenience value that is calculated from the location based
204 * on the `location_id`. Format: the IANA timezone database identifier for the
205 * location timezone.
206 */
207 public function unsetTimezone(): void
208 {
209 $this->timezone = [];
210 }
211
212 /**
213 * Returns Start At.
214 * RFC 3339; shifted to the location timezone + offset. Precision up to the
215 * minute is respected; seconds are truncated.
216 */
217 public function getStartAt(): string
218 {
219 return $this->startAt;
220 }
221
222 /**
223 * Sets Start At.
224 * RFC 3339; shifted to the location timezone + offset. Precision up to the
225 * minute is respected; seconds are truncated.
226 *
227 * @required
228 * @maps start_at
229 */
230 public function setStartAt(string $startAt): void
231 {
232 $this->startAt = $startAt;
233 }
234
235 /**
236 * Returns End At.
237 * RFC 3339; shifted to the timezone + offset. Precision up to the minute is
238 * respected; seconds are truncated.
239 */
240 public function getEndAt(): ?string
241 {
242 if (count($this->endAt) == 0) {
243 return null;
244 }
245 return $this->endAt['value'];
246 }
247
248 /**
249 * Sets End At.
250 * RFC 3339; shifted to the timezone + offset. Precision up to the minute is
251 * respected; seconds are truncated.
252 *
253 * @maps end_at
254 */
255 public function setEndAt(?string $endAt): void
256 {
257 $this->endAt['value'] = $endAt;
258 }
259
260 /**
261 * Unsets End At.
262 * RFC 3339; shifted to the timezone + offset. Precision up to the minute is
263 * respected; seconds are truncated.
264 */
265 public function unsetEndAt(): void
266 {
267 $this->endAt = [];
268 }
269
270 /**
271 * Returns Wage.
272 * The hourly wage rate used to compensate an employee for this shift.
273 */
274 public function getWage(): ?ShiftWage
275 {
276 return $this->wage;
277 }
278
279 /**
280 * Sets Wage.
281 * The hourly wage rate used to compensate an employee for this shift.
282 *
283 * @maps wage
284 */
285 public function setWage(?ShiftWage $wage): void
286 {
287 $this->wage = $wage;
288 }
289
290 /**
291 * Returns Breaks.
292 * A list of all the paid or unpaid breaks that were taken during this shift.
293 *
294 * @return MBreak[]|null
295 */
296 public function getBreaks(): ?array
297 {
298 if (count($this->breaks) == 0) {
299 return null;
300 }
301 return $this->breaks['value'];
302 }
303
304 /**
305 * Sets Breaks.
306 * A list of all the paid or unpaid breaks that were taken during this shift.
307 *
308 * @maps breaks
309 *
310 * @param MBreak[]|null $breaks
311 */
312 public function setBreaks(?array $breaks): void
313 {
314 $this->breaks['value'] = $breaks;
315 }
316
317 /**
318 * Unsets Breaks.
319 * A list of all the paid or unpaid breaks that were taken during this shift.
320 */
321 public function unsetBreaks(): void
322 {
323 $this->breaks = [];
324 }
325
326 /**
327 * Returns Status.
328 * Enumerates the possible status of a `Shift`.
329 */
330 public function getStatus(): ?string
331 {
332 return $this->status;
333 }
334
335 /**
336 * Sets Status.
337 * Enumerates the possible status of a `Shift`.
338 *
339 * @maps status
340 */
341 public function setStatus(?string $status): void
342 {
343 $this->status = $status;
344 }
345
346 /**
347 * Returns Version.
348 * Used for resolving concurrency issues. The request fails if the version
349 * provided does not match the server version at the time of the request. If not provided,
350 * Square executes a blind write; potentially overwriting data from another
351 * write.
352 */
353 public function getVersion(): ?int
354 {
355 return $this->version;
356 }
357
358 /**
359 * Sets Version.
360 * Used for resolving concurrency issues. The request fails if the version
361 * provided does not match the server version at the time of the request. If not provided,
362 * Square executes a blind write; potentially overwriting data from another
363 * write.
364 *
365 * @maps version
366 */
367 public function setVersion(?int $version): void
368 {
369 $this->version = $version;
370 }
371
372 /**
373 * Returns Created At.
374 * A read-only timestamp in RFC 3339 format; presented in UTC.
375 */
376 public function getCreatedAt(): ?string
377 {
378 return $this->createdAt;
379 }
380
381 /**
382 * Sets Created At.
383 * A read-only timestamp in RFC 3339 format; presented in UTC.
384 *
385 * @maps created_at
386 */
387 public function setCreatedAt(?string $createdAt): void
388 {
389 $this->createdAt = $createdAt;
390 }
391
392 /**
393 * Returns Updated At.
394 * A read-only timestamp in RFC 3339 format; presented in UTC.
395 */
396 public function getUpdatedAt(): ?string
397 {
398 return $this->updatedAt;
399 }
400
401 /**
402 * Sets Updated At.
403 * A read-only timestamp in RFC 3339 format; presented in UTC.
404 *
405 * @maps updated_at
406 */
407 public function setUpdatedAt(?string $updatedAt): void
408 {
409 $this->updatedAt = $updatedAt;
410 }
411
412 /**
413 * Returns Team Member Id.
414 * The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26".
415 */
416 public function getTeamMemberId(): ?string
417 {
418 if (count($this->teamMemberId) == 0) {
419 return null;
420 }
421 return $this->teamMemberId['value'];
422 }
423
424 /**
425 * Sets Team Member Id.
426 * The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26".
427 *
428 * @maps team_member_id
429 */
430 public function setTeamMemberId(?string $teamMemberId): void
431 {
432 $this->teamMemberId['value'] = $teamMemberId;
433 }
434
435 /**
436 * Unsets Team Member Id.
437 * The ID of the team member this shift belongs to. Replaced `employee_id` at version "2020-08-26".
438 */
439 public function unsetTeamMemberId(): void
440 {
441 $this->teamMemberId = [];
442 }
443
444 /**
445 * Returns Declared Cash Tip Money.
446 * Represents an amount of money. `Money` fields can be signed or unsigned.
447 * Fields that do not explicitly define whether they are signed or unsigned are
448 * considered unsigned and can only hold positive amounts. For signed fields, the
449 * sign of the value indicates the purpose of the money transfer. See
450 * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-
451 * monetary-amounts)
452 * for more information.
453 */
454 public function getDeclaredCashTipMoney(): ?Money
455 {
456 return $this->declaredCashTipMoney;
457 }
458
459 /**
460 * Sets Declared Cash Tip Money.
461 * Represents an amount of money. `Money` fields can be signed or unsigned.
462 * Fields that do not explicitly define whether they are signed or unsigned are
463 * considered unsigned and can only hold positive amounts. For signed fields, the
464 * sign of the value indicates the purpose of the money transfer. See
465 * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-
466 * monetary-amounts)
467 * for more information.
468 *
469 * @maps declared_cash_tip_money
470 */
471 public function setDeclaredCashTipMoney(?Money $declaredCashTipMoney): void
472 {
473 $this->declaredCashTipMoney = $declaredCashTipMoney;
474 }
475
476 /**
477 * Encode this object to JSON
478 *
479 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
480 * are set. (default: false)
481 *
482 * @return array|stdClass
483 */
484 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
485 public function jsonSerialize(bool $asArrayWhenEmpty = false)
486 {
487 $json = [];
488 if (isset($this->id)) {
489 $json['id'] = $this->id;
490 }
491 if (!empty($this->employeeId)) {
492 $json['employee_id'] = $this->employeeId['value'];
493 }
494 $json['location_id'] = $this->locationId;
495 if (!empty($this->timezone)) {
496 $json['timezone'] = $this->timezone['value'];
497 }
498 $json['start_at'] = $this->startAt;
499 if (!empty($this->endAt)) {
500 $json['end_at'] = $this->endAt['value'];
501 }
502 if (isset($this->wage)) {
503 $json['wage'] = $this->wage;
504 }
505 if (!empty($this->breaks)) {
506 $json['breaks'] = $this->breaks['value'];
507 }
508 if (isset($this->status)) {
509 $json['status'] = $this->status;
510 }
511 if (isset($this->version)) {
512 $json['version'] = $this->version;
513 }
514 if (isset($this->createdAt)) {
515 $json['created_at'] = $this->createdAt;
516 }
517 if (isset($this->updatedAt)) {
518 $json['updated_at'] = $this->updatedAt;
519 }
520 if (!empty($this->teamMemberId)) {
521 $json['team_member_id'] = $this->teamMemberId['value'];
522 }
523 if (isset($this->declaredCashTipMoney)) {
524 $json['declared_cash_tip_money'] = $this->declaredCashTipMoney;
525 }
526 $json = array_filter($json, function ($val) {
527 return $val !== null;
528 });
529
530 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
531 }
532 }
533