MediaWiki  master
PPNode_Hash_Text.php
Go to the documentation of this file.
1 <?php
25 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
26 class PPNode_Hash_Text implements PPNode {
27 
28  public $value;
29  private $store, $index;
30 
38  public function __construct( array $store, $index ) {
39  $this->value = $store[$index];
40  if ( !is_scalar( $this->value ) ) {
41  throw new MWException( __CLASS__ . ' given object instead of string' );
42  }
43  $this->store = $store;
44  $this->index = $index;
45  }
46 
47  public function __toString() {
48  return htmlspecialchars( $this->value );
49  }
50 
51  public function getNextSibling() {
52  return PPNode_Hash_Tree::factory( $this->store, $this->index + 1 );
53  }
54 
55  public function getChildren() {
56  return false;
57  }
58 
59  public function getFirstChild() {
60  return false;
61  }
62 
63  public function getChildrenOfType( $name ) {
64  return false;
65  }
66 
67  public function getLength() {
68  return false;
69  }
70 
71  public function item( $i ) {
72  return false;
73  }
74 
75  public function getName() {
76  return '#text';
77  }
78 
79  public function splitArg() {
80  throw new MWException( __METHOD__ . ': not supported' );
81  }
82 
83  public function splitExt() {
84  throw new MWException( __METHOD__ . ': not supported' );
85  }
86 
87  public function splitHeading() {
88  throw new MWException( __METHOD__ . ': not supported' );
89  }
90 }
PPNode_Hash_Text\splitHeading
splitHeading()
Split an "<h>" node.
Definition: PPNode_Hash_Text.php:87
PPNode_Hash_Text\getChildrenOfType
getChildrenOfType( $name)
Get all children of this tree node which have a given name.
Definition: PPNode_Hash_Text.php:63
PPNode_Hash_Text\getLength
getLength()
Returns the length of the array, or false if this is not an array-type node.
Definition: PPNode_Hash_Text.php:67
PPNode_Hash_Text\__construct
__construct(array $store, $index)
Construct an object using the data from $store[$index].
Definition: PPNode_Hash_Text.php:38
MWException
MediaWiki exception.
Definition: MWException.php:29
PPNode_Hash_Text\getNextSibling
getNextSibling()
Get the next sibling of any node.
Definition: PPNode_Hash_Text.php:51
PPNode_Hash_Text\__toString
__toString()
Definition: PPNode_Hash_Text.php:47
PPNode
There are three types of nodes:
Definition: PPNode.php:35
PPNode_Hash_Text\splitExt
splitExt()
Split an "<ext>" node into an associative array containing name, attr, inner and close All values in ...
Definition: PPNode_Hash_Text.php:83
PPNode_Hash_Text\$value
$value
Definition: PPNode_Hash_Text.php:28
PPNode_Hash_Text\getFirstChild
getFirstChild()
Get the first child of a tree node.
Definition: PPNode_Hash_Text.php:59
PPNode_Hash_Text\$store
$store
Definition: PPNode_Hash_Text.php:29
PPNode_Hash_Text\getName
getName()
Get the name of this node.
Definition: PPNode_Hash_Text.php:75
PPNode_Hash_Text\getChildren
getChildren()
Get an array-type node containing the children of this node.
Definition: PPNode_Hash_Text.php:55
PPNode_Hash_Text
Definition: PPNode_Hash_Text.php:26
PPNode_Hash_Text\item
item( $i)
Returns an item of an array-type node.
Definition: PPNode_Hash_Text.php:71
PPNode_Hash_Text\$index
$index
Definition: PPNode_Hash_Text.php:29
PPNode_Hash_Text\splitArg
splitArg()
Split a "<part>" node into an associative array containing: name PPNode name index String index value...
Definition: PPNode_Hash_Text.php:79
PPNode_Hash_Tree\factory
static factory(array $store, $index)
Construct an appropriate PPNode_Hash_* object with a class that depends on what is at the relevant st...
Definition: PPNode_Hash_Tree.php:81