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 / ContextStackTrait.php
ameliabooking / vendor / sabre / xml / lib Last commit date
Deserializer 6 months ago Element 6 months ago Serializer 6 months ago ContextStackTrait.php 6 months ago Element.php 6 months ago LibXMLException.php 6 months ago ParseException.php 6 months ago Reader.php 6 months ago Service.php 6 months ago Version.php 6 months ago Writer.php 6 months ago XmlDeserializable.php 6 months ago XmlSerializable.php 6 months ago
ContextStackTrait.php
117 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AmeliaVendor\Sabre\Xml;
6
7 /**
8 * Context Stack.
9 *
10 * The Context maintains information about a document during either reading or
11 * writing.
12 *
13 * During this process, it may be necessary to override this context
14 * information.
15 *
16 * This trait allows easy access to the context, and allows the end-user to
17 * override its settings for document fragments, and easily restore it again
18 * later.
19 *
20 * @copyright Copyright (C) 2009-2015 fruux GmbH (https://fruux.com/).
21 * @author Evert Pot (http://evertpot.com/)
22 * @license http://sabre.io/license/ Modified BSD License
23 */
24 trait ContextStackTrait
25 {
26 /**
27 * This is the element map. It contains a list of XML elements (in clark
28 * notation) as keys and PHP class names as values.
29 *
30 * The PHP class names must implement Sabre\Xml\Element.
31 *
32 * Values may also be a callable. In that case the function will be called
33 * directly.
34 *
35 * @phpstan-var array<string, class-string|callable|object>
36 */
37 public array $elementMap = [];
38
39 /**
40 * A contextUri pointing to the document being parsed / written.
41 * This uri may be used to resolve relative urls that may appear in the
42 * document.
43 *
44 * The reader and writer don't use this property, but as it's an extremely
45 * common use-case for parsing XML documents, it's added here as a
46 * convenience.
47 */
48 public ?string $contextUri = null;
49
50 /**
51 * This is a list of namespaces that you want to give default prefixes.
52 *
53 * You must make sure you create this entire list before starting to write.
54 * They should be registered on the root element.
55 *
56 * @phpstan-var array<string, class-string|string|null>
57 */
58 public array $namespaceMap = [];
59
60 /**
61 * This is a list of custom serializers for specific classes.
62 *
63 * The writer may use this if you attempt to serialize an object with a
64 * class that does not implement XmlSerializable.
65 *
66 * Instead, it will look at this classmap to see if there is a custom
67 * serializer here. This is useful if you don't want your value objects
68 * to be responsible for serializing themselves.
69 *
70 * The keys in this classmap need to be fully qualified PHP class names,
71 * the values must be callbacks. The callbacks take two arguments. The
72 * writer class, and the value that must be written.
73 *
74 * function (Writer $writer, object $value)
75 *
76 * @phpstan-var array<class-string, callable(Writer, object):mixed>
77 */
78 public array $classMap = [];
79
80 /**
81 * Backups of previous contexts.
82 *
83 * @var list<mixed>
84 */
85 protected array $contextStack = [];
86
87 /**
88 * Create a new "context".
89 *
90 * This allows you to safely modify the elementMap, contextUri or
91 * namespaceMap. After you're done, you can restore the old data again
92 * with popContext.
93 */
94 public function pushContext(): void
95 {
96 $this->contextStack[] = [
97 $this->elementMap,
98 $this->contextUri,
99 $this->namespaceMap,
100 $this->classMap,
101 ];
102 }
103
104 /**
105 * Restore the previous "context".
106 */
107 public function popContext(): void
108 {
109 list(
110 $this->elementMap,
111 $this->contextUri,
112 $this->namespaceMap,
113 $this->classMap,
114 ) = array_pop($this->contextStack);
115 }
116 }
117