public function testFind() { $token = $this->getTokenMock('token.name'); $context = new Context(); $context->push($token); $this->assertSame($token->id, $context->find('token.name')); $this->assertFalse($context->find('foo')); }
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; }