| 1 |
<?php |
| 2 |
|
| 3 |
// AUTOMATICALLY GENERATED. DO NOT EDIT. |
| 4 |
// Use `composer build` to regenerate. |
| 5 |
|
| 6 |
namespace Wikimedia\IDLeDOM\Helper; |
| 7 |
|
| 8 |
trait Range { |
| 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\Range $this'; |
| 44 |
// @var \Wikimedia\IDLeDOM\Range $this |
| 45 |
switch ( $name ) { |
| 46 |
case "startContainer": |
| 47 |
return $this->getStartContainer(); |
| 48 |
case "startOffset": |
| 49 |
return $this->getStartOffset(); |
| 50 |
case "endContainer": |
| 51 |
return $this->getEndContainer(); |
| 52 |
case "endOffset": |
| 53 |
return $this->getEndOffset(); |
| 54 |
case "collapsed": |
| 55 |
return $this->getCollapsed(); |
| 56 |
case "commonAncestorContainer": |
| 57 |
return $this->getCommonAncestorContainer(); |
| 58 |
default: |
| 59 |
break; |
| 60 |
} |
| 61 |
'@phan-var \Wikimedia\IDLeDOM\Helper\Range $this'; |
| 62 |
// @var \Wikimedia\IDLeDOM\Helper\Range $this |
| 63 |
return $this->_getMissingProp( $name ); |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* @param string $name |
| 68 |
* @return bool |
| 69 |
*/ |
| 70 |
public function __isset( string $name ): bool { |
| 71 |
'@phan-var \Wikimedia\IDLeDOM\Range $this'; |
| 72 |
// @var \Wikimedia\IDLeDOM\Range $this |
| 73 |
switch ( $name ) { |
| 74 |
case "startContainer": |
| 75 |
return true; |
| 76 |
case "startOffset": |
| 77 |
return true; |
| 78 |
case "endContainer": |
| 79 |
return true; |
| 80 |
case "endOffset": |
| 81 |
return true; |
| 82 |
case "collapsed": |
| 83 |
return true; |
| 84 |
case "commonAncestorContainer": |
| 85 |
return true; |
| 86 |
default: |
| 87 |
break; |
| 88 |
} |
| 89 |
return false; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* @return string |
| 94 |
*/ |
| 95 |
public function __toString(): string { |
| 96 |
'@phan-var \Wikimedia\IDLeDOM\Range $this'; |
| 97 |
// @var \Wikimedia\IDLeDOM\Range $this |
| 98 |
return $this->toString(); |
| 99 |
} |
| 100 |
|
| 101 |
} |