Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/CustomEventInit.php

raw
1 <?php
2
3 // AUTOMATICALLY GENERATED. DO NOT EDIT.
4 // Use `composer build` to regenerate.
5
6 namespace Wikimedia\IDLeDOM\Helper;
7
8 trait CustomEventInit {
9
10 // Underscore is used to avoid conflicts with DOM-reserved names
11 // phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
12 // phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
13
14 /**
15 * Handle an attempt to get a non-existing property on this
16 * object. The default implementation raises an exception
17 * but the implementor can choose a different behavior:
18 * return null (like JavaScript), dynamically create the
19 * property, etc.
20 * @param string $prop the name of the property requested
21 * @return mixed
22 */
23 abstract protected function _getMissingProp( string $prop );
24
25 /**
26 * Handle an attempt to set a non-existing property on this
27 * object. The default implementation raises an exception
28 * but the implementor can choose a different behavior:
29 * ignore the operation (like JavaScript), dynamically create
30 * the property, etc.
31 * @param string $prop the name of the property requested
32 * @param mixed $value the value to set
33 */
34 abstract protected function _setMissingProp( string $prop, $value ): void;
35
36 // phpcs:enable
37
38 /**
39 * @param string $name
40 * @return mixed
41 */
42 public function __get( string $name ) {
43 '@phan-var \Wikimedia\IDLeDOM\CustomEventInit $this';
44 // @var \Wikimedia\IDLeDOM\CustomEventInit $this
45 switch ( $name ) {
46 case "bubbles":
47 return $this->getBubbles();
48 case "cancelable":
49 return $this->getCancelable();
50 case "composed":
51 return $this->getComposed();
52 case "detail":
53 return $this->getDetail();
54 default:
55 break;
56 }
57 '@phan-var \Wikimedia\IDLeDOM\Helper\CustomEventInit $this';
58 // @var \Wikimedia\IDLeDOM\Helper\CustomEventInit $this
59 return $this->_getMissingProp( $name );
60 }
61
62 /**
63 * @param string $name
64 * @return bool
65 */
66 public function __isset( string $name ): bool {
67 '@phan-var \Wikimedia\IDLeDOM\CustomEventInit $this';
68 // @var \Wikimedia\IDLeDOM\CustomEventInit $this
69 switch ( $name ) {
70 case "bubbles":
71 return true;
72 case "cancelable":
73 return true;
74 case "composed":
75 return true;
76 case "detail":
77 return true;
78 default:
79 break;
80 }
81 return false;
82 }
83
84 /**
85 * @param mixed $offset
86 * @return bool
87 */
88 public function offsetExists( $offset ): bool {
89 switch ( $offset ) {
90 case "bubbles":
91 case "cancelable":
92 case "composed":
93 case "detail":
94 return true;
95 default:
96 break;
97 }
98 return false;
99 }
100
101 /**
102 * @param mixed $offset
103 * @return mixed
104 */
105 #[\ReturnTypeWillChange]
106 public function offsetGet( $offset ) {
107 return $this->$offset;
108 }
109
110 /**
111 * @param mixed $offset
112 * @param mixed $value
113 */
114 public function offsetSet( $offset, $value ): void {
115 $this->$offset = $value;
116 }
117
118 /**
119 * @param mixed $offset
120 */
121 public function offsetUnset( $offset ): void {
122 unset( $this->$offset );
123 }
124
125 /**
126 * Create a CustomEventInit from an associative array.
127 *
128 * @param array|\Wikimedia\IDLeDOM\CustomEventInit $a
129 * @return \Wikimedia\IDLeDOM\CustomEventInit
130 */
131 public static function cast( $a ) {
132 if ( $a instanceof \Wikimedia\IDLeDOM\CustomEventInit ) {
133 return $a;
134 }
135 return new class( $a ) extends \Wikimedia\IDLeDOM\CustomEventInit {
136 use CustomEventInit;
137
138 /** @var array */
139 private $a;
140
141 /**
142 * @param array $a
143 */
144 public function __construct( $a ) {
145 $this->a = $a;
146 }
147
148 /**
149 * @return bool
150 */
151 public function getBubbles(): bool {
152 return $this->a["bubbles"] ?? false;
153 }
154
155 /**
156 * @return bool
157 */
158 public function getCancelable(): bool {
159 return $this->a["cancelable"] ?? false;
160 }
161
162 /**
163 * @return bool
164 */
165 public function getComposed(): bool {
166 return $this->a["composed"] ?? false;
167 }
168
169 /**
170 * @return mixed|null
171 */
172 public function getDetail() {
173 return $this->a["detail"] ?? null;
174 }
175
176 };
177 }
178
179 }