Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/AssignedNodesOptions.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 AssignedNodesOptions {
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 protected function _getMissingProp( string $prop ) {
24 $trace = debug_backtrace();
25 while (
26 count( $trace ) > 0 &&
27 $trace[0]['function'] !== "__get"
28 ) {
29 array_shift( $trace );
30 }
31 trigger_error(
32 'Undefined property' .
33 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
34 ' in ' . ( $trace[0]['file'] ?? '' ) .
35 ' on line ' . ( $trace[0]['line'] ?? '' ),
36 E_USER_NOTICE
37 );
38 return null;
39 }
40
41 /**
42 * Handle an attempt to set a non-existing property on this
43 * object. The default implementation raises an exception
44 * but the implementor can choose a different behavior:
45 * ignore the operation (like JavaScript), dynamically create
46 * the property, etc.
47 * @param string $prop the name of the property requested
48 * @param mixed $value the value to set
49 */
50 protected function _setMissingProp( string $prop, $value ): void {
51 $trace = debug_backtrace();
52 while (
53 count( $trace ) > 0 &&
54 $trace[0]['function'] !== "__set"
55 ) {
56 array_shift( $trace );
57 }
58 trigger_error(
59 'Undefined property' .
60 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $prop .
61 ' in ' . ( $trace[0]['file'] ?? '' ) .
62 ' on line ' . ( $trace[0]['line'] ?? '' ),
63 E_USER_NOTICE
64 );
65 }
66
67 // phpcs:enable
68
69 /**
70 * @param string $name
71 * @return mixed
72 */
73 public function __get( string $name ) {
74 '@phan-var \Wikimedia\IDLeDOM\AssignedNodesOptions $this';
75 // @var \Wikimedia\IDLeDOM\AssignedNodesOptions $this
76 switch ( $name ) {
77 case "flatten":
78 return $this->getFlatten();
79 default:
80 break;
81 }
82 '@phan-var \Wikimedia\IDLeDOM\Helper\AssignedNodesOptions $this';
83 // @var \Wikimedia\IDLeDOM\Helper\AssignedNodesOptions $this
84 return $this->_getMissingProp( $name );
85 }
86
87 /**
88 * @param string $name
89 * @return bool
90 */
91 public function __isset( string $name ): bool {
92 '@phan-var \Wikimedia\IDLeDOM\AssignedNodesOptions $this';
93 // @var \Wikimedia\IDLeDOM\AssignedNodesOptions $this
94 switch ( $name ) {
95 case "flatten":
96 return true;
97 default:
98 break;
99 }
100 return false;
101 }
102
103 /**
104 * @param mixed $offset
105 * @return bool
106 */
107 public function offsetExists( $offset ): bool {
108 switch ( $offset ) {
109 case "flatten":
110 return true;
111 default:
112 break;
113 }
114 return false;
115 }
116
117 /**
118 * @param mixed $offset
119 * @return mixed
120 */
121 #[\ReturnTypeWillChange]
122 public function offsetGet( $offset ) {
123 return $this->$offset;
124 }
125
126 /**
127 * @param mixed $offset
128 * @param mixed $value
129 */
130 public function offsetSet( $offset, $value ): void {
131 $this->$offset = $value;
132 }
133
134 /**
135 * @param mixed $offset
136 */
137 public function offsetUnset( $offset ): void {
138 unset( $this->$offset );
139 }
140
141 /**
142 * Create a AssignedNodesOptions from an associative array.
143 *
144 * @param array|\Wikimedia\IDLeDOM\AssignedNodesOptions $a
145 * @return \Wikimedia\IDLeDOM\AssignedNodesOptions
146 */
147 public static function cast( $a ) {
148 if ( $a instanceof \Wikimedia\IDLeDOM\AssignedNodesOptions ) {
149 return $a;
150 }
151 return new class( $a ) extends \Wikimedia\IDLeDOM\AssignedNodesOptions {
152 use AssignedNodesOptions;
153
154 /** @var array */
155 private $a;
156
157 /**
158 * @param array $a
159 */
160 public function __construct( $a ) {
161 $this->a = $a;
162 }
163
164 /**
165 * @return bool
166 */
167 public function getFlatten(): bool {
168 return $this->a["flatten"] ?? false;
169 }
170
171 };
172 }
173
174 }