MediaWiki REL1_40
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
29 public $value;
31 private $store;
33 private $index;
34
42 public function __construct( array $store, $index ) {
43 $this->value = $store[$index];
44 if ( !is_scalar( $this->value ) ) {
45 throw new MWException( __CLASS__ . ' given object instead of string' );
46 }
47 $this->store = $store;
48 $this->index = $index;
49 }
50
51 public function __toString() {
52 return htmlspecialchars( $this->value, ENT_COMPAT );
53 }
54
55 public function getNextSibling() {
56 return PPNode_Hash_Tree::factory( $this->store, $this->index + 1 );
57 }
58
59 public function getChildren() {
60 return false;
61 }
62
63 public function getFirstChild() {
64 return false;
65 }
66
67 public function getChildrenOfType( $name ) {
68 return false;
69 }
70
71 public function getLength() {
72 return false;
73 }
74
75 public function item( $i ) {
76 return false;
77 }
78
79 public function getName() {
80 return '#text';
81 }
82
83 public function splitArg() {
84 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
85 throw new MWException( __METHOD__ . ': not supported' );
86 }
87
88 public function splitExt() {
89 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
90 throw new MWException( __METHOD__ . ': not supported' );
91 }
92
93 public function splitHeading() {
94 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
95 throw new MWException( __METHOD__ . ': not supported' );
96 }
97}
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