public function testPop() { $foo = $this->getTokenMock('foo'); $bar = $this->getTokenMock('bar'); $context = new Context(); $context->push($foo); $context->push($bar); $context->pop($foo); $this->assertSame(['bar'], array_values($context->stack)); $context->pop($bar); $this->assertEmpty($context->stack); }
protected function processEnd(Context $context, Language $language, Result $result, TokenIterator $tokens) { if ($this->_start) { $context->pop($this->_start); } else { if (($start = $context->find($this->name)) !== false) { $this->setStart($tokens[$start]); unset($context->stack[$start]); } } if (!$this->_start instanceof MetaToken) { $result->append($this); } return true; }