Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 84 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
CSSStyleSheet | |
0.00% |
0 / 84 |
|
0.00% |
0 / 4 |
1806 | |
0.00% |
0 / 1 |
_getMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
_setMissingProp | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
__get | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
156 | |||
__isset | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
156 | |||
__set | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
__unset | |
0.00% |
0 / 32 |
|
0.00% |
0 / 1 |
210 |
1 | <?php |
2 | |
3 | // AUTOMATICALLY GENERATED. DO NOT EDIT. |
4 | // Use `composer build` to regenerate. |
5 | |
6 | namespace Wikimedia\IDLeDOM\Helper; |
7 | |
8 | trait CSSStyleSheet { |
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\CSSStyleSheet $this'; |
44 | // @var \Wikimedia\IDLeDOM\CSSStyleSheet $this |
45 | switch ( $name ) { |
46 | case "type": |
47 | return $this->getType(); |
48 | case "href": |
49 | return $this->getHref(); |
50 | case "ownerNode": |
51 | return $this->getOwnerNode(); |
52 | case "parentStyleSheet": |
53 | return $this->getParentStyleSheet(); |
54 | case "title": |
55 | return $this->getTitle(); |
56 | case "media": |
57 | return $this->getMedia(); |
58 | case "disabled": |
59 | return $this->getDisabled(); |
60 | case "ownerRule": |
61 | return $this->getOwnerRule(); |
62 | case "cssRules": |
63 | return $this->getCssRules(); |
64 | case "rules": |
65 | return $this->getRules(); |
66 | default: |
67 | break; |
68 | } |
69 | '@phan-var \Wikimedia\IDLeDOM\Helper\CSSStyleSheet $this'; |
70 | // @var \Wikimedia\IDLeDOM\Helper\CSSStyleSheet $this |
71 | return $this->_getMissingProp( $name ); |
72 | } |
73 | |
74 | /** |
75 | * @param string $name |
76 | * @return bool |
77 | */ |
78 | public function __isset( string $name ): bool { |
79 | '@phan-var \Wikimedia\IDLeDOM\CSSStyleSheet $this'; |
80 | // @var \Wikimedia\IDLeDOM\CSSStyleSheet $this |
81 | switch ( $name ) { |
82 | case "type": |
83 | return true; |
84 | case "href": |
85 | return $this->getHref() !== null; |
86 | case "ownerNode": |
87 | return $this->getOwnerNode() !== null; |
88 | case "parentStyleSheet": |
89 | return $this->getParentStyleSheet() !== null; |
90 | case "title": |
91 | return $this->getTitle() !== null; |
92 | case "media": |
93 | return true; |
94 | case "disabled": |
95 | return true; |
96 | case "ownerRule": |
97 | return $this->getOwnerRule() !== null; |
98 | case "cssRules": |
99 | return true; |
100 | case "rules": |
101 | return true; |
102 | default: |
103 | break; |
104 | } |
105 | return false; |
106 | } |
107 | |
108 | /** |
109 | * @param string $name |
110 | * @param mixed $value |
111 | */ |
112 | public function __set( string $name, $value ): void { |
113 | '@phan-var \Wikimedia\IDLeDOM\CSSStyleSheet $this'; |
114 | // @var \Wikimedia\IDLeDOM\CSSStyleSheet $this |
115 | switch ( $name ) { |
116 | case "media": |
117 | $this->setMedia( $value ); |
118 | return; |
119 | case "disabled": |
120 | $this->setDisabled( $value ); |
121 | return; |
122 | default: |
123 | break; |
124 | } |
125 | '@phan-var \Wikimedia\IDLeDOM\Helper\CSSStyleSheet $this'; |
126 | // @var \Wikimedia\IDLeDOM\Helper\CSSStyleSheet $this |
127 | $this->_setMissingProp( $name, $value ); |
128 | } |
129 | |
130 | /** |
131 | * @param string $name |
132 | */ |
133 | public function __unset( string $name ): void { |
134 | '@phan-var \Wikimedia\IDLeDOM\CSSStyleSheet $this'; |
135 | // @var \Wikimedia\IDLeDOM\CSSStyleSheet $this |
136 | switch ( $name ) { |
137 | case "type": |
138 | break; |
139 | case "href": |
140 | break; |
141 | case "ownerNode": |
142 | break; |
143 | case "parentStyleSheet": |
144 | break; |
145 | case "title": |
146 | break; |
147 | case "media": |
148 | break; |
149 | case "disabled": |
150 | break; |
151 | case "ownerRule": |
152 | break; |
153 | case "cssRules": |
154 | break; |
155 | case "rules": |
156 | break; |
157 | default: |
158 | return; |
159 | } |
160 | $trace = debug_backtrace(); |
161 | while ( |
162 | count( $trace ) > 0 && |
163 | $trace[0]['function'] !== "__unset" |
164 | ) { |
165 | array_shift( $trace ); |
166 | } |
167 | trigger_error( |
168 | 'Undefined property' . |
169 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
170 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
171 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
172 | E_USER_NOTICE |
173 | ); |
174 | } |
175 | |
176 | } |