MediaWiki REL1_35
PPNode_Hash_Text.php
Go to the documentation of this file.
1<?php
25// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
26class 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}
MediaWiki exception.
getChildren()
Get an array-type node containing the children of this node.
getChildrenOfType( $name)
Get all children of this tree node which have a given name.
__construct(array $store, $index)
Construct an object using the data from $store[$index].
getLength()
Returns the length of the array, or false if this is not an array-type node.
splitHeading()
Split an "<h>" node.
getFirstChild()
Get the first child of a tree node.
getNextSibling()
Get the next sibling of any node.
splitArg()
Split a "<part>" node into an associative array containing: name PPNode name index String index value...
getName()
Get the name of this node.
item( $i)
Returns an item of an array-type node.
splitExt()
Split an "<ext>" node into an associative array containing name, attr, inner and close All values in ...
static factory(array $store, $index)
Construct an appropriate PPNode_Hash_* object with a class that depends on what is at the relevant st...
There are three types of nodes:
Definition PPNode.php:35