PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / helpers / libraries / ical / parser.php
vikappointments / site / helpers / libraries / ical Last commit date
parser 3 days ago reader 3 days ago event.php 3 days ago importer.php 3 days ago index.html 3 days ago parser.php 3 days ago reader.php 3 days ago
parser.php
67 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Abstraction of an iCalendar parser.
16 *
17 * @since 1.7.3
18 */
19 abstract class VAPIcalParser
20 {
21 /**
22 * Interface used to extract an iCalendar buffer
23 * from a specific source.
24 *
25 * @var VAPIcalReader
26 */
27 private $reader;
28
29 /**
30 * An array of options.
31 *
32 * @var JRegistry
33 */
34 protected $options;
35
36 /**
37 * Class constructor.
38 *
39 * @param VAPIcalReader $source
40 */
41 final public function __construct(VAPIcalReader $reader, array $options = [])
42 {
43 $this->reader = $reader;
44 $this->options = new JRegistry($options);
45 }
46
47 /**
48 * Parses the iCalendar from the buffer.
49 *
50 * @return array
51 */
52 final public function parse()
53 {
54 // parse calendar
55 return $this->parseBuffer($this->reader->load());
56 }
57
58 /**
59 * Implements the algorithm used to parse the iCalendar buffer.
60 *
61 * @param string $buffer
62 *
63 * @return array
64 */
65 abstract protected function parseBuffer($buffer);
66 }
67