Debian Codegraph @

vendor/wikimedia/idle-dom/src/Helper/CSSRule.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 CSSRule {
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\CSSRule $this';
75 // @var \Wikimedia\IDLeDOM\CSSRule $this
76 switch ( $name ) {
77 case "cssText":
78 return $this->getCssText();
79 case "parentRule":
80 return $this->getParentRule();
81 case "parentStyleSheet":
82 return $this->getParentStyleSheet();
83 case "type":
84 return $this->getType();
85 default:
86 break;
87 }
88 '@phan-var \Wikimedia\IDLeDOM\Helper\CSSRule $this';
89 // @var \Wikimedia\IDLeDOM\Helper\CSSRule $this
90 return $this->_getMissingProp( $name );
91 }
92
93 /**
94 * @param string $name
95 * @return bool
96 */
97 public function __isset( string $name ): bool {
98 '@phan-var \Wikimedia\IDLeDOM\CSSRule $this';
99 // @var \Wikimedia\IDLeDOM\CSSRule $this
100 switch ( $name ) {
101 case "cssText":
102 return true;
103 case "parentRule":
104 return $this->getParentRule() !== null;
105 case "parentStyleSheet":
106 return $this->getParentStyleSheet() !== null;
107 case "type":
108 return true;
109 default:
110 break;
111 }
112 return false;
113 }
114
115 /**
116 * @param string $name
117 * @param mixed $value
118 */
119 public function __set( string $name, $value ): void {
120 '@phan-var \Wikimedia\IDLeDOM\CSSRule $this';
121 // @var \Wikimedia\IDLeDOM\CSSRule $this
122 switch ( $name ) {
123 case "cssText":
124 $this->setCssText( $value );
125 return;
126 default:
127 break;
128 }
129 '@phan-var \Wikimedia\IDLeDOM\Helper\CSSRule $this';
130 // @var \Wikimedia\IDLeDOM\Helper\CSSRule $this
131 $this->_setMissingProp( $name, $value );
132 }
133
134 /**
135 * @param string $name
136 */
137 public function __unset( string $name ): void {
138 '@phan-var \Wikimedia\IDLeDOM\CSSRule $this';
139 // @var \Wikimedia\IDLeDOM\CSSRule $this
140 switch ( $name ) {
141 case "cssText":
142 break;
143 case "parentRule":
144 break;
145 case "parentStyleSheet":
146 break;
147 case "type":
148 break;
149 default:
150 return;
151 }
152 $trace = debug_backtrace();
153 while (
154 count( $trace ) > 0 &&
155 $trace[0]['function'] !== "__unset"
156 ) {
157 array_shift( $trace );
158 }
159 trigger_error(
160 'Undefined property' .
161 ' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name .
162 ' in ' . ( $trace[0]['file'] ?? '' ) .
163 ' on line ' . ( $trace[0]['line'] ?? '' ),
164 E_USER_NOTICE
165 );
166 }
167
168 }