protected function checkEnd($type, $data)
{
$lastTag = array_pop($this->stack);
if (!is_array($lastTag)) {
throw new Exceptions\OutputGeneratorException(sprintf('Invalid close: Trying to close on empty stack.'));
}
if (array($lastTag[0], $lastTag[1]) !== array($type, $data)) {
throw new Exceptions\OutputGeneratorException(sprintf('Invalid close: Trying to close %s:%s, while last element was %s:%s.', $type, $data, $lastTag[0], $lastTag[1]));
}
}