| 1 |
<?php |
| 2 |
|
| 3 |
// AUTOMATICALLY GENERATED. DO NOT EDIT. |
| 4 |
// Use `composer build` to regenerate. |
| 5 |
|
| 6 |
namespace Wikimedia\IDLeDOM\Helper; |
| 7 |
|
| 8 |
trait CustomEvent { |
| 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\CustomEvent $this'; |
| 44 |
// @var \Wikimedia\IDLeDOM\CustomEvent $this |
| 45 |
switch ( $name ) { |
| 46 |
case "type": |
| 47 |
return $this->getType(); |
| 48 |
case "target": |
| 49 |
return $this->getTarget(); |
| 50 |
case "srcElement": |
| 51 |
return $this->getSrcElement(); |
| 52 |
case "currentTarget": |
| 53 |
return $this->getCurrentTarget(); |
| 54 |
case "eventPhase": |
| 55 |
return $this->getEventPhase(); |
| 56 |
case "cancelBubble": |
| 57 |
return $this->getCancelBubble(); |
| 58 |
case "bubbles": |
| 59 |
return $this->getBubbles(); |
| 60 |
case "cancelable": |
| 61 |
return $this->getCancelable(); |
| 62 |
case "returnValue": |
| 63 |
return $this->getReturnValue(); |
| 64 |
case "defaultPrevented": |
| 65 |
return $this->getDefaultPrevented(); |
| 66 |
case "composed": |
| 67 |
return $this->getComposed(); |
| 68 |
case "isTrusted": |
| 69 |
return $this->getIsTrusted(); |
| 70 |
case "timeStamp": |
| 71 |
return $this->getTimeStamp(); |
| 72 |
case "detail": |
| 73 |
return $this->getDetail(); |
| 74 |
default: |
| 75 |
break; |
| 76 |
} |
| 77 |
'@phan-var \Wikimedia\IDLeDOM\Helper\CustomEvent $this'; |
| 78 |
// @var \Wikimedia\IDLeDOM\Helper\CustomEvent $this |
| 79 |
return $this->_getMissingProp( $name ); |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* @param string $name |
| 84 |
* @return bool |
| 85 |
*/ |
| 86 |
public function __isset( string $name ): bool { |
| 87 |
'@phan-var \Wikimedia\IDLeDOM\CustomEvent $this'; |
| 88 |
// @var \Wikimedia\IDLeDOM\CustomEvent $this |
| 89 |
switch ( $name ) { |
| 90 |
case "type": |
| 91 |
return true; |
| 92 |
case "target": |
| 93 |
return $this->getTarget() !== null; |
| 94 |
case "srcElement": |
| 95 |
return $this->getSrcElement() !== null; |
| 96 |
case "currentTarget": |
| 97 |
return $this->getCurrentTarget() !== null; |
| 98 |
case "eventPhase": |
| 99 |
return true; |
| 100 |
case "cancelBubble": |
| 101 |
return true; |
| 102 |
case "bubbles": |
| 103 |
return true; |
| 104 |
case "cancelable": |
| 105 |
return true; |
| 106 |
case "returnValue": |
| 107 |
return true; |
| 108 |
case "defaultPrevented": |
| 109 |
return true; |
| 110 |
case "composed": |
| 111 |
return true; |
| 112 |
case "isTrusted": |
| 113 |
return true; |
| 114 |
case "timeStamp": |
| 115 |
return true; |
| 116 |
case "detail": |
| 117 |
return true; |
| 118 |
default: |
| 119 |
break; |
| 120 |
} |
| 121 |
return false; |
| 122 |
} |
| 123 |
|
| 124 |
/** |
| 125 |
* @param string $name |
| 126 |
* @param mixed $value |
| 127 |
*/ |
| 128 |
public function __set( string $name, $value ): void { |
| 129 |
'@phan-var \Wikimedia\IDLeDOM\CustomEvent $this'; |
| 130 |
// @var \Wikimedia\IDLeDOM\CustomEvent $this |
| 131 |
switch ( $name ) { |
| 132 |
case "cancelBubble": |
| 133 |
$this->setCancelBubble( $value ); |
| 134 |
return; |
| 135 |
case "returnValue": |
| 136 |
$this->setReturnValue( $value ); |
| 137 |
return; |
| 138 |
default: |
| 139 |
break; |
| 140 |
} |
| 141 |
'@phan-var \Wikimedia\IDLeDOM\Helper\CustomEvent $this'; |
| 142 |
// @var \Wikimedia\IDLeDOM\Helper\CustomEvent $this |
| 143 |
$this->_setMissingProp( $name, $value ); |
| 144 |
} |
| 145 |
|
| 146 |
/** |
| 147 |
* @param string $name |
| 148 |
*/ |
| 149 |
public function __unset( string $name ): void { |
| 150 |
'@phan-var \Wikimedia\IDLeDOM\CustomEvent $this'; |
| 151 |
// @var \Wikimedia\IDLeDOM\CustomEvent $this |
| 152 |
switch ( $name ) { |
| 153 |
case "type": |
| 154 |
break; |
| 155 |
case "target": |
| 156 |
break; |
| 157 |
case "srcElement": |
| 158 |
break; |
| 159 |
case "currentTarget": |
| 160 |
break; |
| 161 |
case "eventPhase": |
| 162 |
break; |
| 163 |
case "cancelBubble": |
| 164 |
break; |
| 165 |
case "bubbles": |
| 166 |
break; |
| 167 |
case "cancelable": |
| 168 |
break; |
| 169 |
case "returnValue": |
| 170 |
break; |
| 171 |
case "defaultPrevented": |
| 172 |
break; |
| 173 |
case "composed": |
| 174 |
break; |
| 175 |
case "isTrusted": |
| 176 |
break; |
| 177 |
case "timeStamp": |
| 178 |
break; |
| 179 |
case "detail": |
| 180 |
break; |
| 181 |
default: |
| 182 |
return; |
| 183 |
} |
| 184 |
$trace = debug_backtrace(); |
| 185 |
while ( |
| 186 |
count( $trace ) > 0 && |
| 187 |
$trace[0]['function'] !== "__unset" |
| 188 |
) { |
| 189 |
array_shift( $trace ); |
| 190 |
} |
| 191 |
trigger_error( |
| 192 |
'Undefined property' . |
| 193 |
' via ' . ( $trace[0]['function'] ?? '' ) . '(): ' . $name . |
| 194 |
' in ' . ( $trace[0]['file'] ?? '' ) . |
| 195 |
' on line ' . ( $trace[0]['line'] ?? '' ), |
| 196 |
E_USER_NOTICE |
| 197 |
); |
| 198 |
} |
| 199 |
|
| 200 |
} |