PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.22
Booktics – Appointment Booking Calendar for Service Businesses v1.0.22
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / core / appointment / schedule / time-slot.php

time-slot.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.22, at core/appointment/schedule/time-slot.php

96 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Booktics\Appointment\Schedule;
3
4 use JsonSerializable;
5
6 /**
7 * Timeslot class
8 */
9 class Time_Slot implements JsonSerializable {
10 /**
11 * Store start time
12 *
13 * @var string
14 */
15 public $start;
16
17 /**
18 * Store end time
19 *
20 * @var string
21 */
22 public $end;
23
24 /**
25 * Store time slot status
26 *
27 * @var bool
28 */
29 public $is_available;
30
31 /**
32 * Store maximum capacity
33 *
34 * @var int
35 */
36 public $max_capacity;
37
38 /**
39 * Store booked count
40 *
41 * @var int
42 */
43 public $booked_count;
44
45 /**
46 * Store available spots
47 *
48 * @var int
49 */
50 public $available_spots;
51
52 /**
53 * Constructor timeslot class
54 *
55 * @param string $start Start time for a time slot
56 * @param string $end End time for a time slot
57 * @param bool $is_available Status for time slot
58 * @param true
59 *
60 * @return void
61 */
62 public function __construct( string $start, string $end, bool $is_available = true, int $max_capacity = 1, int $available_spots = 1, int $booked_count = 0 ) {
63 $this->start = $start;
64 $this->end = $end;
65 $this->is_available = $is_available;
66 $this->max_capacity = $max_capacity;
67 $this->booked_count = $booked_count;
68 $this->available_spots = $available_spots;
69 }
70
71 /**
72 * Get time slot data as an array
73 *
74 * @return array Timeslot data
75 */
76 public function to_array(): array {
77 return [
78 'start' => $this->start,
79 'end' => $this->end,
80 'is_available' => $this->is_available,
81 'max_capacity' => $this->max_capacity,
82 'booked_count' => $this->booked_count,
83 'available_spots' => $this->available_spots,
84 ];
85 }
86
87 /**
88 * Specify data which should be serialized to JSON.
89 *
90 * @return array
91 */
92 public function jsonSerialize(): array {
93 return $this->to_array();
94 }
95 }
96