FOF30\Less\Formatter\Classic::block PHP Method

block() public method

Output a CSS block
public block ( stdClass $block ) : void
$block stdClass The block definition to output
return void
    public function block($block)
    {
        if ($this->isEmpty($block)) {
            return;
        }
        $inner = $pre = $this->indentStr();
        $isSingle = !$this->disableSingle && is_null($block->type) && count($block->lines) == 1;
        if (!empty($block->selectors)) {
            $this->indentLevel++;
            if ($this->breakSelectors) {
                $selectorSeparator = $this->selectorSeparator . $this->break . $pre;
            } else {
                $selectorSeparator = $this->selectorSeparator;
            }
            echo $pre . implode($selectorSeparator, $block->selectors);
            if ($isSingle) {
                echo $this->openSingle;
                $inner = "";
            } else {
                echo $this->open . $this->break;
                $inner = $this->indentStr();
            }
        }
        if (!empty($block->lines)) {
            $glue = $this->break . $inner;
            echo $inner . implode($glue, $block->lines);
            if (!$isSingle && !empty($block->children)) {
                echo $this->break;
            }
        }
        foreach ($block->children as $child) {
            $this->block($child);
        }
        if (!empty($block->selectors)) {
            if (!$isSingle && empty($block->children)) {
                echo $this->break;
            }
            if ($isSingle) {
                echo $this->closeSingle . $this->break;
            } else {
                echo $pre . $this->close . $this->break;
            }
            $this->indentLevel--;
        }
    }