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