Merge "Follow-up 3535a5f327: Remove old CSS now caches have expired"
[lhc/web/wiklou.git] / includes / parser / PPNode_Hash_Text.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup Parser
20 */
21
22 /**
23 * @ingroup Parser
24 */
25 // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
26 class PPNode_Hash_Text implements PPNode {
27
28 public $value;
29 private $store, $index;
30
31 /**
32 * Construct an object using the data from $store[$index]. The rest of the
33 * store array can be accessed via getNextSibling().
34 *
35 * @param array $store
36 * @param int $index
37 */
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 }