| Total Complexity | 7 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | class Expanded extends Formatter |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | public function __construct() |
||
| 28 | { |
||
| 29 | $this->indentLevel = 0; |
||
| 30 | $this->indentChar = ' '; |
||
| 31 | $this->break = "\n"; |
||
| 32 | $this->open = ' {'; |
||
| 33 | $this->close = '}'; |
||
| 34 | $this->tagSeparator = ', '; |
||
| 35 | $this->assignSeparator = ': '; |
||
| 36 | $this->keepSemicolons = true; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | */ |
||
| 42 | protected function indentStr() |
||
| 43 | { |
||
| 44 | return str_repeat($this->indentChar, $this->indentLevel); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * {@inheritdoc} |
||
| 49 | */ |
||
| 50 | protected function blockLines(OutputBlock $block) |
||
| 51 | { |
||
| 52 | $inner = $this->indentStr(); |
||
| 53 | |||
| 54 | $glue = $this->break . $inner; |
||
| 55 | |||
| 56 | foreach ($block->lines as $index => $line) { |
||
| 57 | if (substr($line, 0, 2) === '/*') { |
||
| 58 | $block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 62 | $this->write($inner . implode($glue, $block->lines)); |
||
| 63 | |||
| 64 | if (empty($block->selectors) || ! empty($block->children)) { |
||
| 65 | $this->write($this->break); |
||
| 66 | } |
||
| 69 |