Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/StyleSheet.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 StyleSheet {
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\StyleSheet $this';
75 // @var \Wikimedia\IDLeDOM\StyleSheet $this
76 switch ( $name ) {
77 case "type":
78 return $this->getType();
79 case "href":
80 return $this->getHref();
81 case "ownerNode":
82 return $this->getOwnerNode();
83 case "parentStyleSheet":
84 return $this->getParentStyleSheet();
85 case "title":
86 return $this->getTitle();
87 case "media":
88 return $this->getMedia();
89 case "disabled":
90 return $this->getDisabled();
91 default:
92 break;
93 }
94 '@phan-var \Wikimedia\IDLeDOM\Helper\StyleSheet $this';
95 // @var \Wikimedia\IDLeDOM\Helper\StyleSheet $this
96 return $this->_getMissingProp( $name );
97 }
98
99 /**
100 * @param string $name
101 * @return bool
102 */
103 public function __isset( string $name ): bool {
104 '@phan-var \Wikimedia\IDLeDOM\StyleSheet $this';
105 // @var \Wikimedia\IDLeDOM\StyleSheet $this
106 switch ( $name ) {
107 case "type":
108 return true;
109 case "href":
110 return $this->getHref() !== null;
111 case "ownerNode":
112 return $this->getOwnerNode() !== null;
113 case "parentStyleSheet":
114 return $this->getParentStyleSheet() !== null;
115 case "title":
116 return $this->getTitle() !== null;
117 case "media":
118 return true;
119 case "disabled":
120 return true;
121 default:
122 break;
123 }
124 return false;
125 }
126
127 /**
128 * @param string $name
129 * @param mixed $value
130 */
131 public function __set( string $name, $value ): void {
132 '@phan-var \Wikimedia\IDLeDOM\StyleSheet $this';
133 // @var \Wikimedia\IDLeDOM\StyleSheet $this
134 switch ( $name ) {
135 case "media":
136 $this->setMedia( $value );
137 return;
138 case "disabled":
139 $this->setDisabled( $value );
140 return;
141 default:
142 break;
143 }
144 '@phan-var \Wikimedia\IDLeDOM\Helper\StyleSheet $this';
145 // @var \Wikimedia\IDLeDOM\Helper\StyleSheet $this
146 $this->_setMissingProp( $name, $value );
147 }
148
149 /**
150 * @param string $name
151 */
152 public function __unset( string $name ): void {
153 '@phan-var \Wikimedia\IDLeDOM\StyleSheet $this';
154 // @var \Wikimedia\IDLeDOM\StyleSheet $this
155 switch ( $name ) {
156 case "type":
157 break;
158 case "href":
159 break;
160 case "ownerNode":
161 break;
162 case "parentStyleSheet":
163 break;
164 case "title":
165 break;
166 case "media":
167 break;
168 case "disabled":
169 break;
170 default:
171 return;
172 }
173 $trace = debug_backtrace();
174 while (
175 count( $trace ) > 0 &&
176 $trace[0]['function'] !== "__unset"
177 ) {
178 array_shift( $trace );
179 }
180 trigger_error(
181 'Undefined property' .
182 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
183 ' in ' . ( $trace[0]['file'] ?? '' ) .
184 ' on line ' . ( $trace[0]['line'] ?? '' ),
185 E_USER_NOTICE
186 );
187 }
188
189 /**
190 * @param ?string $val
191 */
192 public function setMedia( ?string $val ): void {
193 '@phan-var \Wikimedia\IDLeDOM\StyleSheet $this';
194 // @var \Wikimedia\IDLeDOM\StyleSheet $this
195 $this->getMedia()->setMediaText( $val );
196 }
197
198 }