PluginProbe
MaxButtons – Create buttons / 7.0
MaxButtons – Create buttons v7.0
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 / Crunched.php

Crunched.php in MaxButtons – Create buttons 7.0, at assets/libraries/scssphp/src/Formatter/Crunched.php

72 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-2015 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 * SCSS crunched formatter
19 *
20 * @author Anthon Pang <anthon.pang@gmail.com>
21 */
22 class Crunched 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 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function stripSemicolon(&$lines)
42 {
43 if (($count = count($lines))
44 && substr($lines[$count - 1], -1) === ';'
45 ) {
46 $lines[$count - 1] = substr($lines[$count - 1], 0, -1);
47 }
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function blockLines(OutputBlock $block)
54 {
55 $inner = $this->indentStr();
56
57 $glue = $this->break . $inner;
58
59 foreach ($block->lines as $index => $line) {
60 if (substr($line, 0, 2) === '/*') {
61 unset($block->lines[$index]);
62 }
63 }
64
65 echo $inner . implode($glue, $block->lines);
66
67 if (! empty($block->children)) {
68 echo $this->break;
69 }
70 }
71 }
72