| 1 |
<?php |
| 2 |
|
| 3 |
// AUTOMATICALLY GENERATED. DO NOT EDIT. |
| 4 |
// Use `composer build` to regenerate. |
| 5 |
|
| 6 |
namespace Wikimedia\IDLeDOM\Helper; |
| 7 |
|
| 8 |
trait CSSGroupingRule { |
| 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\CSSGroupingRule $this'; |
| 44 |
// @var \Wikimedia\IDLeDOM\CSSGroupingRule $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 |
default: |
| 57 |
break; |
| 58 |
} |
| 59 |
'@phan-var \Wikimedia\IDLeDOM\Helper\CSSGroupingRule $this'; |
| 60 |
// @var \Wikimedia\IDLeDOM\Helper\CSSGroupingRule $this |
| 61 |
return $this->_getMissingProp( $name ); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* @param string $name |
| 66 |
* @return bool |
| 67 |
*/ |
| 68 |
public function __isset( string $name ): bool { |
| 69 |
'@phan-var \Wikimedia\IDLeDOM\CSSGroupingRule $this'; |
| 70 |
// @var \Wikimedia\IDLeDOM\CSSGroupingRule $this |
| 71 |
switch ( $name ) { |
| 72 |
case "cssText": |
| 73 |
return true; |
| 74 |
case "parentRule": |
| 75 |
return $this->getParentRule() !== null; |
| 76 |
case "parentStyleSheet": |
| 77 |
return $this->getParentStyleSheet() !== null; |
| 78 |
case "type": |
| 79 |
return true; |
| 80 |
case "cssRules": |
| 81 |
return true; |
| 82 |
default: |
| 83 |
break; |
| 84 |
} |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
/** |
| 89 |
* @param string $name |
| 90 |
* @param mixed $value |
| 91 |
*/ |
| 92 |
public function __set( string $name, $value ): void { |
| 93 |
'@phan-var \Wikimedia\IDLeDOM\CSSGroupingRule $this'; |
| 94 |
// @var \Wikimedia\IDLeDOM\CSSGroupingRule $this |
| 95 |
switch ( $name ) { |
| 96 |
case "cssText": |
| 97 |
$this->setCssText( $value ); |
| 98 |
return; |
| 99 |
default: |
| 100 |
break; |
| 101 |
} |
| 102 |
'@phan-var \Wikimedia\IDLeDOM\Helper\CSSGroupingRule $this'; |
| 103 |
// @var \Wikimedia\IDLeDOM\Helper\CSSGroupingRule $this |
| 104 |
$this->_setMissingProp( $name, $value ); |
| 105 |
} |
| 106 |
|
| 107 |
/** |
| 108 |
* @param string $name |
| 109 |
*/ |
| 110 |
public function __unset( string $name ): void { |
| 111 |
'@phan-var \Wikimedia\IDLeDOM\CSSGroupingRule $this'; |
| 112 |
// @var \Wikimedia\IDLeDOM\CSSGroupingRule $this |
| 113 |
switch ( $name ) { |
| 114 |
case "cssText": |
| 115 |
break; |
| 116 |
case "parentRule": |
| 117 |
break; |
| 118 |
case "parentStyleSheet": |
| 119 |
break; |
| 120 |
case "type": |
| 121 |
break; |
| 122 |
case "cssRules": |
| 123 |
break; |
| 124 |
default: |
| 125 |
return; |
| 126 |
} |
| 127 |
$trace = debug_backtrace(); |
| 128 |
while ( |
| 129 |
count( $trace ) > 0 && |
| 130 |
$trace[0]['function'] !== "__unset" |
| 131 |
) { |
| 132 |
array_shift( $trace ); |
| 133 |
} |
| 134 |
trigger_error( |
| 135 |
'Undefined property' . |
| 136 |
' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
| 137 |
' in ' . ( $trace[0]['file'] ?? '' ) . |
| 138 |
' on line ' . ( $trace[0]['line'] ?? '' ), |
| 139 |
E_USER_NOTICE |
| 140 |
); |
| 141 |
} |
| 142 |
|
| 143 |
} |