MediaWiki master
PPNode_Hash_Array.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Parser;
9
10use LogicException;
11use Stringable;
12
16// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
17class PPNode_Hash_Array implements Stringable, PPNode {
18
20 public $value;
21
25 public function __construct( $value ) {
26 $this->value = $value;
27 }
28
29 public function __toString() {
30 return var_export( $this, true );
31 }
32
34 public function getLength() {
35 return count( $this->value );
36 }
37
39 public function item( $i ) {
40 return $this->value[$i];
41 }
42
44 public function getName() {
45 return '#nodelist';
46 }
47
49 public function getNextSibling() {
50 return false;
51 }
52
54 public function getChildren() {
55 return false;
56 }
57
59 public function getFirstChild() {
60 return false;
61 }
62
64 public function getChildrenOfType( $name ) {
65 return false;
66 }
67
69 public function splitArg() {
70 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
71 throw new LogicException( __METHOD__ . ': not supported' );
72 }
73
75 public function splitExt() {
76 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
77 throw new LogicException( __METHOD__ . ': not supported' );
78 }
79
81 public function splitHeading() {
82 // @phan-suppress-previous-line PhanPluginNeverReturnMethod
83 throw new LogicException( __METHOD__ . ': not supported' );
84 }
85}
86
88class_alias( PPNode_Hash_Array::class, 'PPNode_Hash_Array' );
item( $i)
Returns an item of an array-type node.PPNode|false
splitExt()
Split an "<ext>" node into an associative array containing name, attr, inner and close All values in ...
getFirstChild()
Get the first child of a tree node.False if there isn't one.false|PPNode
splitArg()
Split a "<part>" node into an associative array containing: name PPNode name index String index value...
splitHeading()
Split an "<h>" node.array
getNextSibling()
Get the next sibling of any node.False if there isn't one false|PPNode
getChildren()
Get an array-type node containing the children of this node.Returns false if this is not a tree node....
getName()
Get the name of this node.The following names are defined here:h A heading node. template A double-br...
getLength()
Returns the length of the array, or false if this is not an array-type node.
getChildrenOfType( $name)
Get all children of this tree node which have a given name.Returns an array-type node,...
There are three types of nodes:
Definition PPNode.php:23