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 / Debug.php

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

122 lines 2.5 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 * Debug formatter
19 *
20 * @author Anthon Pang <anthon.pang@gmail.com>
21 */
22 class Debug 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->indentLevel);
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 protected function blockLines(OutputBlock $block)
51 {
52 $indent = $this->indentStr();
53
54 if (empty($block->lines)) {
55 $this->write("{$indent}block->lines: []\n");
56
57 return;
58 }
59
60 foreach ($block->lines as $index => $line) {
61 $this->write("{$indent}block->lines[{$index}]: $line\n");
62 }
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 protected function blockSelectors(OutputBlock $block)
69 {
70 $indent = $this->indentStr();
71
72 if (empty($block->selectors)) {
73 $this->write("{$indent}block->selectors: []\n");
74
75 return;
76 }
77
78 foreach ($block->selectors as $index => $selector) {
79 $this->write("{$indent}block->selectors[{$index}]: $selector\n");
80 }
81 }
82
83 /**
84 * {@inheritdoc}
85 */
86 protected function blockChildren(OutputBlock $block)
87 {
88 $indent = $this->indentStr();
89
90 if (empty($block->children)) {
91 $this->write("{$indent}block->children: []\n");
92
93 return;
94 }
95
96 $this->indentLevel++;
97
98 foreach ($block->children as $i => $child) {
99 $this->block($child);
100 }
101
102 $this->indentLevel--;
103 }
104
105 /**
106 * {@inheritdoc}
107 */
108 protected function block(OutputBlock $block)
109 {
110 $indent = $this->indentStr();
111
112 $this->write("{$indent}block->type: {$block->type}\n" .
113 "{$indent}block->depth: {$block->depth}\n");
114
115 $this->currentBlock = $block;
116
117 $this->blockSelectors($block);
118 $this->blockLines($block);
119 $this->blockChildren($block);
120 }
121 }
122