PluginProbe
MaxButtons – Create buttons / 6.7
MaxButtons – Create buttons v6.7
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 / Compressed.php

Compressed.php in MaxButtons – Create buttons 6.7, at assets/libraries/scssphp/src/Formatter/Compressed.php

84 lines 1.8 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
16 /**
17 * SCSS compressed formatter
18 *
19 * @author Leaf Corcoran <leafot@gmail.com>
20 */
21 class Compressed extends Formatter
22 {
23 /**
24 * {@inheritdoc}
25 */
26 public function __construct()
27 {
28 $this->indentLevel = 0;
29 $this->indentChar = ' ';
30 $this->break = '';
31 $this->open = '{';
32 $this->close = '}';
33 $this->tagSeparator = ',';
34 $this->assignSeparator = ':';
35 }
36
37 /**
38 * {@inheritdoc}
39 */
40 public function stripSemicolon(&$lines)
41 {
42 if (($count = count($lines))
43 && substr($lines[$count - 1], -1) === ';'
44 ) {
45 $lines[$count - 1] = substr($lines[$count - 1], 0, -1);
46 }
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 public function blockLines($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) === '/*' && substr($line, 2, 1) !== '!') {
60 unset($block->lines[$index]);
61 } elseif (substr($line, 0, 3) === '/*!') {
62 $block->lines[$index] = '/*' . substr($line, 3);
63 }
64 }
65
66 echo $inner . implode($glue, $block->lines);
67
68 if (! empty($block->children)) {
69 echo $this->break;
70 }
71 }
72
73 /**
74 * {@inherit}
75 */
76 public function format($block)
77 {
78 return parent::format($block);
79
80 // TODO: we need to fix the 2 "compressed" tests where the "close" is applied
81 return trim(str_replace(';}', '}', parent::format($block)));
82 }
83 }
84