PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / vendor / wpfluent / caldav / src / Entities / Event.php

Event.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at vendor/wpfluent/caldav/src/Entities/Event.php

112 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\Package\CalDav\Entities;
4
5 class Event implements \JsonSerializable
6 {
7 /**
8 * The \Entities\Calendar object
9 * @var null
10 */
11 protected $calendar = null;
12
13 /**
14 * The \ICal\Event object
15 * @var null
16 */
17 protected $icalEvent = [];
18
19 /**
20 * Information about the calebdar
21 *
22 * @var array
23 */
24 protected $meta = [];
25
26 public function __construct($event, array $meta)
27 {
28 $this->meta = $meta;
29 $this->icalEvent = $event;
30 }
31
32 /**
33 * Getter to get underlying Event Object
34 * @return \ICal\Event
35 */
36 public function getIcalEvent()
37 {
38 return $this->icalEvent;
39 }
40
41 /**
42 * Dynamic property getter
43 *
44 * @param string $key
45 * @return mixed
46 */
47 public function __get($key)
48 {
49 if (isset($this->meta[$key])) {
50 return $this->meta[$key];
51 }
52
53 return $this->icalEvent->{$key};
54 }
55
56 /**
57 * Get the uid of underlying event
58 * @return [type] [description]
59 */
60 public function getUid()
61 {
62 return $this->icalEvent->getUid();
63 }
64
65 /**
66 * Dynamic property setter
67 *
68 * @param string $key
69 * @param mixed $value
70 * @return mixed
71 */
72 public function __set($key, $value)
73 {
74 $this->icalEvent->{$key} = $value;
75 }
76
77 /**
78 * Create/Update an event
79 *
80 * @return \Ical\Event
81 */
82 public function save()
83 {
84 if ($this->calendar->addEvent($this->icalEvent)) {
85 return $this->calendar->getEvent($this->icalEvent->getUid());
86 }
87 }
88
89 public function delete()
90 {
91 return $this->calendar->deleteEvent(
92 $this->icalEvent->getUid()
93 );
94 }
95
96 /**
97 * Set the calendar object
98 *
99 * @param \Entities\Calendar
100 */
101 public function setCalendar($calendar)
102 {
103 $this->calendar = $calendar;
104 }
105
106 #[\ReturnTypeWillChange]
107 public function jsonSerialize()
108 {
109 return $this->icalEvent;
110 }
111 }
112