1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- class HTMLPurifier_Queue {
- private $input;
- private $output;
- public function __construct($input = array()) {
- $this->input = $input;
- $this->output = array();
- }
-
- public function shift() {
- if (empty($this->output)) {
- $this->output = array_reverse($this->input);
- $this->input = array();
- }
- if (empty($this->output)) {
- return NULL;
- }
- return array_pop($this->output);
- }
-
- public function push($x) {
- array_push($this->input, $x);
- }
-
- public function isEmpty() {
- return empty($this->input) && empty($this->output);
- }
- }
|