protected function parse_hierarchy($self_close = null)
{
$tag_curr = strtolower($this->status['tag_name']);
if ($self_close === null) {
$this->status['self_close'] = $self_close = isset($this->tags_selfclose[$tag_curr]);
}
if (!($self_close || $this->status['closing_tag'])) {
//$tag_prev = strtolower(end($this->hierarchy)->tag);
$tag_prev = strtolower($this->hierarchy[count($this->hierarchy) - 1]->tag);
if (isset($this->tags_optional_close[$tag_curr]) && isset($this->tags_optional_close[$tag_curr][$tag_prev])) {
array_pop($this->hierarchy);
}
}
return parent::parse_hierarchy($self_close);
}