protected function flattenSelectors($block, $parentKey = null)
{
if ($block->selectors) {
$selectors = array();
foreach ($block->selectors as $s) {
$selectors[] = $s;
if (!is_array($s)) {
continue;
}
// check extends
if (!empty($this->extendsMap)) {
$this->matchExtends($s, $selectors);
}
}
$block->selectors = array();
$placeholderSelector = false;
foreach ($selectors as $selector) {
if ($this->hasSelectorPlaceholder($selector)) {
$placeholderSelector = true;
continue;
}
$block->selectors[] = $this->compileSelector($selector);
}
if ($placeholderSelector && 0 == count($block->selectors) && null !== $parentKey) {
unset($block->parent->children[$parentKey]);
return;
}
}
foreach ($block->children as $key => $child) {
$this->flattenSelectors($child, $key);
}
}