PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.5.2
Jetpack – WP Security, Backup, Speed, & Growth v13.5.2
12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / vendor / scssphp / scssphp / src / Formatter / Debug.php
Debug.php
128 lines 2.6 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 * Debug formatter
19 *
20 * @author Anthon Pang <anthon.pang@gmail.com>
21 *
22 * @deprecated since 1.4.0.
23 *
24 * @internal
25 */
26 class Debug extends Formatter
27 {
28 /**
29 * {@inheritdoc}
30 */
31 public function __construct()
32 {
33 @trigger_error('The Debug formatter is deprecated since 1.4.0.', E_USER_DEPRECATED);
34
35 $this->indentLevel = 0;
36 $this->indentChar = '';
37 $this->break = "\n";
38 $this->open = ' {';
39 $this->close = ' }';
40 $this->tagSeparator = ', ';
41 $this->assignSeparator = ': ';
42 $this->keepSemicolons = true;
43 }
44
45 /**
46 * {@inheritdoc}
47 */
48 protected function indentStr()
49 {
50 return str_repeat(' ', $this->indentLevel);
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 protected function blockLines(OutputBlock $block)
57 {
58 $indent = $this->indentStr();
59
60 if (empty($block->lines)) {
61 $this->write("{$indent}block->lines: []\n");
62
63 return;
64 }
65
66 foreach ($block->lines as $index => $line) {
67 $this->write("{$indent}block->lines[{$index}]: $line\n");
68 }
69 }
70
71 /**
72 * {@inheritdoc}
73 */
74 protected function blockSelectors(OutputBlock $block)
75 {
76 $indent = $this->indentStr();
77
78 if (empty($block->selectors)) {
79 $this->write("{$indent}block->selectors: []\n");
80
81 return;
82 }
83
84 foreach ($block->selectors as $index => $selector) {
85 $this->write("{$indent}block->selectors[{$index}]: $selector\n");
86 }
87 }
88
89 /**
90 * {@inheritdoc}
91 */
92 protected function blockChildren(OutputBlock $block)
93 {
94 $indent = $this->indentStr();
95
96 if (empty($block->children)) {
97 $this->write("{$indent}block->children: []\n");
98
99 return;
100 }
101
102 $this->indentLevel++;
103
104 foreach ($block->children as $i => $child) {
105 $this->block($child);
106 }
107
108 $this->indentLevel--;
109 }
110
111 /**
112 * {@inheritdoc}
113 */
114 protected function block(OutputBlock $block)
115 {
116 $indent = $this->indentStr();
117
118 $this->write("{$indent}block->type: {$block->type}\n" .
119 "{$indent}block->depth: {$block->depth}\n");
120
121 $this->currentBlock = $block;
122
123 $this->blockSelectors($block);
124 $this->blockLines($block);
125 $this->blockChildren($block);
126 }
127 }
128