eZ\Publish\Core\REST\Common\Output\Generator::checkEnd PHP Method

checkEnd() protected method

Check close / end operation.
protected checkEnd ( string $type, mixed $data )
$type string
$data mixed
    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]));
        }
    }