PluginProbe
MaxButtons – Create buttons / 7.11
MaxButtons – Create buttons v7.11
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / assets / libraries / scssphp / src / Formatter / Expanded.php

Expanded.php in MaxButtons – Create buttons 7.11, at assets/libraries/scssphp/src/Formatter/Expanded.php

69 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * SCSSPHP
4 *
5 * @copyright 2012-2018 Leaf Corcoran
6 *
7 * @license http://opensource.org/licenses/MIT MIT
8 *
9 * @link http://leafo.github.io/scssphp
10 */
11
12 namespace Leafo\ScssPhp\Formatter;
13
14 use Leafo\ScssPhp\Formatter;
15 use Leafo\ScssPhp\Formatter\OutputBlock;
16
17 /**
18 * Expanded formatter
19 *
20 * @author Leaf Corcoran <leafot@gmail.com>
21 */
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 }
67 }
68 }
69