MediaWiki REL1_39
PPDStack_Hash.php
Go to the documentation of this file.
1<?php
26// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
29 public $stack;
31 public $rootAccum;
33 public $accum;
34
38 public $top;
39 public $out;
40 public $elementClass = PPDStackElement_Hash::class;
41
42 public static $false = false;
43
44 public function __construct() {
45 $this->stack = [];
46 $this->top = false;
47 $this->rootAccum = [];
48 $this->accum =& $this->rootAccum;
49 }
50
54 public function count() {
55 return count( $this->stack );
56 }
57
58 public function &getAccum() {
59 return $this->accum;
60 }
61
65 public function getCurrentPart() {
66 if ( $this->top === false ) {
67 return false;
68 } else {
69 return $this->top->getCurrentPart();
70 }
71 }
72
73 public function push( $data ) {
74 if ( $data instanceof $this->elementClass ) {
75 $this->stack[] = $data;
76 } else {
77 $class = $this->elementClass;
78 $this->stack[] = new $class( $data );
79 }
80 $this->top = $this->stack[count( $this->stack ) - 1];
81 $this->accum =& $this->top->getAccum();
82 }
83
84 public function pop() {
85 if ( $this->stack === [] ) {
86 throw new MWException( __METHOD__ . ': no elements remaining' );
87 }
88 $temp = array_pop( $this->stack );
89
90 if ( count( $this->stack ) ) {
91 $this->top = $this->stack[count( $this->stack ) - 1];
92 $this->accum =& $this->top->getAccum();
93 } else {
94 $this->top = self::$false;
95 $this->accum =& $this->rootAccum;
96 }
97 return $temp;
98 }
99
100 public function addPart( $s = '' ) {
101 $this->top->addPart( $s );
102 $this->accum =& $this->top->getAccum();
103 }
104
108 public function getFlags() {
109 if ( $this->stack === [] ) {
110 return [
111 'findEquals' => false,
112 'findPipe' => false,
113 'inHeading' => false,
114 ];
115 } else {
116 return $this->top->getFlags();
117 }
118 }
119}
MediaWiki exception.
Stack class to help Preprocessor::preprocessToObj()
PPDStackElement_Hash[] $stack
PPDStackElement_Hash false $top
string[] $rootAccum
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s