PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / composer-libraries / vendor / scssphp / scssphp / src / Formatter / Expanded.php

Expanded.php in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.2, at composer-libraries/vendor/scssphp/scssphp/src/Formatter/Expanded.php

73 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * SCSSPHP
5 *
6 * @copyright 2012-2020 Leaf Corcoran
7 *
8 * @license http://opensource.org/licenses/MIT MIT
9 *
10 * @link http://scssphp.github.io/scssphp
11 */
12
13 namespace ScssPhp\ScssPhp\Formatter;
14
15 use ScssPhp\ScssPhp\Formatter;
16
17 /**
18 * Expanded formatter
19 *
20 * @author Leaf Corcoran <[email protected]>
21 *
22 * @internal
23 */
24 class Expanded extends Formatter
25 {
26 /**
27 * {@inheritdoc}
28 */
29 public function __construct()
30 {
31 $this->indentLevel = 0;
32 $this->indentChar = ' ';
33 $this->break = "\n";
34 $this->open = ' {';
35 $this->close = '}';
36 $this->tagSeparator = ', ';
37 $this->assignSeparator = ': ';
38 $this->keepSemicolons = true;
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 protected function indentStr()
45 {
46 return str_repeat($this->indentChar, $this->indentLevel);
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 protected function blockLines(OutputBlock $block)
53 {
54 $inner = $this->indentStr();
55
56 $glue = $this->break . $inner;
57
58 foreach ($block->lines as $index => $line) {
59 if (substr($line, 0, 2) === '/*') {
60 $replacedLine = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
61 assert($replacedLine !== null);
62 $block->lines[$index] = $replacedLine;
63 }
64 }
65
66 $this->write($inner . implode($glue, $block->lines));
67
68 if (empty($block->selectors) || ! empty($block->children)) {
69 $this->write($this->break);
70 }
71 }
72 }
73