Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 73 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
DOMStringMap | |
0.00% |
0 / 73 |
|
0.00% |
0 / 6 |
702 | |
0.00% |
0 / 1 |
_getMissingProp | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
_setMissingProp | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 | |||
offsetExists | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
offsetGet | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
90 | |||
offsetSet | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
30 | |||
offsetUnset | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
30 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait DOMStringMap { |
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 mixed $offset |
71 | * @return bool |
72 | */ |
73 | public function offsetExists( $offset ): bool { |
74 | return $this->offsetGet( $offset ) !== null; |
75 | } |
76 | |
77 | /** |
78 | * @param mixed $offset |
79 | * @return mixed |
80 | */ |
81 | #[\ReturnTypeWillChange] |
82 | public function offsetGet( $offset ) { |
83 | '@phan-var \Wikimedia\IDLeDOM\DOMStringMap $this'; |
84 | // @var \Wikimedia\IDLeDOM\DOMStringMap $this |
85 | if ( is_numeric( $offset ) ) { |
86 | /* Fall through */ |
87 | } elseif ( is_string( $offset ) ) { |
88 | return $this->namedItem( $offset ); |
89 | } |
90 | $trace = debug_backtrace(); |
91 | while ( |
92 | count( $trace ) > 0 && |
93 | $trace[0]['function'] !== "offsetGet" && |
94 | $trace[0]['function'] !== "offsetExists" |
95 | ) { |
96 | array_shift( $trace ); |
97 | } |
98 | while ( |
99 | count( $trace ) > 1 && ( |
100 | $trace[1]['function'] === "offsetGet" || |
101 | $trace[1]['function'] === "offsetExists" |
102 | ) ) { |
103 | array_shift( $trace ); |
104 | } |
105 | trigger_error( |
106 | 'Undefined property' . |
107 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
108 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
109 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
110 | E_USER_NOTICE |
111 | ); |
112 | return null; |
113 | } |
114 | |
115 | /** |
116 | * @param mixed $offset |
117 | * @param mixed $value |
118 | */ |
119 | public function offsetSet( $offset, $value ): void { |
120 | '@phan-var \Wikimedia\IDLeDOM\DOMStringMap $this'; |
121 | // @var \Wikimedia\IDLeDOM\DOMStringMap $this |
122 | if ( is_numeric( $offset ) ) { |
123 | /* Fall through */ |
124 | } elseif ( is_string( $offset ) ) { |
125 | $this->setNamedItem( $offset, $value ); |
126 | } |
127 | $trace = debug_backtrace(); |
128 | while ( |
129 | count( $trace ) > 0 && |
130 | $trace[0]['function'] !== "offsetSet" |
131 | ) { |
132 | array_shift( $trace ); |
133 | } |
134 | trigger_error( |
135 | 'Undefined property' . |
136 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
137 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
138 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
139 | E_USER_NOTICE |
140 | ); |
141 | } |
142 | |
143 | /** |
144 | * @param mixed $offset |
145 | */ |
146 | public function offsetUnset( $offset ): void { |
147 | '@phan-var \Wikimedia\IDLeDOM\DOMStringMap $this'; |
148 | // @var \Wikimedia\IDLeDOM\DOMStringMap $this |
149 | if ( is_numeric( $offset ) ) { |
150 | /* Fall through */ |
151 | } elseif ( is_string( $offset ) ) { |
152 | $this->removeNamedItem( $offset ); |
153 | } |
154 | $trace = debug_backtrace(); |
155 | while ( |
156 | count( $trace ) > 0 && |
157 | $trace[0]['function'] !== "offsetUnset" |
158 | ) { |
159 | array_shift( $trace ); |
160 | } |
161 | trigger_error( |
162 | 'Undefined property' . |
163 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $offset . |
164 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
165 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
166 | E_USER_NOTICE |
167 | ); |
168 | } |
169 | |
170 | } |