Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 67 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
CSSImportRule | |
0.00% |
0 / 67 |
|
0.00% |
0 / 5 |
1190 | |
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 / 8 |
|
0.00% |
0 / 1 |
20 | |||
__unset | |
0.00% |
0 / 26 |
|
0.00% |
0 / 1 |
132 | |||
setMedia | |
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 CSSImportRule { |
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\CSSImportRule $this'; |
44 | // @var \Wikimedia\IDLeDOM\CSSImportRule $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 "href": |
55 | return $this->getHref(); |
56 | case "media": |
57 | return $this->getMedia(); |
58 | case "styleSheet": |
59 | return $this->getStyleSheet(); |
60 | default: |
61 | break; |
62 | } |
63 | '@phan-var \Wikimedia\IDLeDOM\Helper\CSSImportRule $this'; |
64 | // @var \Wikimedia\IDLeDOM\Helper\CSSImportRule $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\CSSImportRule $this'; |
74 | // @var \Wikimedia\IDLeDOM\CSSImportRule $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 "href": |
85 | return true; |
86 | case "media": |
87 | return true; |
88 | case "styleSheet": |
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\CSSImportRule $this'; |
102 | // @var \Wikimedia\IDLeDOM\CSSImportRule $this |
103 | switch ( $name ) { |
104 | case "cssText": |
105 | $this->setCssText( $value ); |
106 | return; |
107 | case "media": |
108 | $this->setMedia( $value ); |
109 | return; |
110 | default: |
111 | break; |
112 | } |
113 | '@phan-var \Wikimedia\IDLeDOM\Helper\CSSImportRule $this'; |
114 | // @var \Wikimedia\IDLeDOM\Helper\CSSImportRule $this |
115 | $this->_setMissingProp( $name, $value ); |
116 | } |
117 | |
118 | /** |
119 | * @param string $name |
120 | */ |
121 | public function __unset( string $name ): void { |
122 | '@phan-var \Wikimedia\IDLeDOM\CSSImportRule $this'; |
123 | // @var \Wikimedia\IDLeDOM\CSSImportRule $this |
124 | switch ( $name ) { |
125 | case "cssText": |
126 | break; |
127 | case "parentRule": |
128 | break; |
129 | case "parentStyleSheet": |
130 | break; |
131 | case "type": |
132 | break; |
133 | case "href": |
134 | break; |
135 | case "media": |
136 | break; |
137 | case "styleSheet": |
138 | break; |
139 | default: |
140 | return; |
141 | } |
142 | $trace = debug_backtrace(); |
143 | while ( |
144 | count( $trace ) > 0 && |
145 | $trace[0]['function'] !== "__unset" |
146 | ) { |
147 | array_shift( $trace ); |
148 | } |
149 | trigger_error( |
150 | 'Undefined property' . |
151 | ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
152 | ' in ' . ( $trace[0]['file'] ?? '' ) . |
153 | ' on line ' . ( $trace[0]['line'] ?? '' ), |
154 | E_USER_NOTICE |
155 | ); |
156 | } |
157 | |
158 | /** |
159 | * @param ?string $val |
160 | */ |
161 | public function setMedia( ?string $val ): void { |
162 | '@phan-var \Wikimedia\IDLeDOM\CSSImportRule $this'; |
163 | // @var \Wikimedia\IDLeDOM\CSSImportRule $this |
164 | $this->getMedia()->setMediaText( $val ); |
165 | } |
166 | |
167 | } |