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