6 * @copyright 2012-2020 Leaf Corcoran
8 * @license http://opensource.org/licenses/MIT MIT
10 * @link http://scssphp.github.io/scssphp
13 namespace ScssPhp\ScssPhp\Formatter
;
15 use ScssPhp\ScssPhp\Formatter
;
20 * @author Leaf Corcoran <leafot@gmail.com>
22 class Expanded
extends Formatter
27 public function __construct()
29 $this->indentLevel
= 0;
30 $this->indentChar
= ' ';
34 $this->tagSeparator
= ', ';
35 $this->assignSeparator
= ': ';
36 $this->keepSemicolons
= true;
42 protected function indentStr()
44 return str_repeat($this->indentChar
, $this->indentLevel
);
50 protected function blockLines(OutputBlock
$block)
52 $inner = $this->indentStr();
54 $glue = $this->break . $inner;
56 foreach ($block->lines
as $index => $line) {
57 if (substr($line, 0, 2) === '/*') {
58 $block->lines
[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
62 $this->write($inner . implode($glue, $block->lines
));
64 if (empty($block->selectors
) ||
! empty($block->children
)) {
65 $this->write($this->break);