PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / sabre / xml / lib / Element / Uri.php
ameliabooking / vendor / sabre / xml / lib / Element Last commit date
Base.php 6 months ago Cdata.php 6 months ago Elements.php 6 months ago KeyValue.php 6 months ago Uri.php 6 months ago XmlFragment.php 6 months ago
Uri.php
96 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AmeliaVendor\Sabre\Xml\Element;
6
7 use AmeliaVendor\Sabre\Xml;
8
9 use function AmeliaVendor\Sabre\Uri\resolve;
10
11 /**
12 * Uri element.
13 *
14 * This represents a single uri. An example of how this may be encoded:
15 *
16 * <link>/foo/bar</link>
17 * <d:href xmlns:d="DAV:">http://example.org/hi</d:href>
18 *
19 * If the uri is relative, it will be automatically expanded to an absolute
20 * url during writing and reading, if the contextUri property is set on the
21 * reader and/or writer.
22 *
23 * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
24 * @author Evert Pot (http://evertpot.com/)
25 * @license http://sabre.io/license/ Modified BSD License
26 */
27 class Uri implements Xml\Element
28 {
29 /**
30 * Uri element value.
31 */
32 protected string $value;
33
34 /**
35 * Constructor.
36 */
37 public function __construct(string $value)
38 {
39 $this->value = $value;
40 }
41
42 /**
43 * The xmlSerialize method is called during xml writing.
44 *
45 * Use the $writer argument to write its own xml serialization.
46 *
47 * An important note: do _not_ create a parent element. Any element
48 * implementing XmlSerializable should only ever write what's considered
49 * its 'inner xml'.
50 *
51 * The parent of the current element is responsible for writing a
52 * containing element.
53 *
54 * This allows serializers to be re-used for different element names.
55 *
56 * If you are opening new elements, you must also close them again.
57 */
58 public function xmlSerialize(Xml\Writer $writer): void
59 {
60 $writer->text(
61 resolve(
62 $writer->contextUri ?? '',
63 $this->value
64 )
65 );
66 }
67
68 /**
69 * This method is called during xml parsing.
70 *
71 * This method is called statically, this is because in theory this method
72 * may be used as a type of constructor, or factory method.
73 *
74 * Often you want to return an instance of the current class, but you are
75 * free to return other data as well.
76 *
77 * Important note 2: You are responsible for advancing the reader to the
78 * next element. Not doing anything will result in a never-ending loop.
79 *
80 * If you just want to skip parsing for this element altogether, you can
81 * just call $reader->next();
82 *
83 * $reader->parseSubTree() will parse the entire sub-tree, and advance to
84 * the next element.
85 */
86 public static function xmlDeserialize(Xml\Reader $reader)
87 {
88 return new self(
89 resolve(
90 (string) $reader->contextUri,
91 $reader->readText()
92 )
93 );
94 }
95 }
96