Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
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 class Debug extends Formatter 25 { 26 /** 27 * {@inheritdoc} 28 */ 29 public function __construct() 30 { 31 @trigger_error('The Debug formatter is deprecated since 1.4.0.', E_USER_DEPRECATED); 32 33 $this->indentLevel = 0; 34 $this->indentChar = ''; 35 $this->break = "\n"; 36 $this->open = ' {'; 37 $this->close = ' }'; 38 $this->tagSeparator = ', '; 39 $this->assignSeparator = ': '; 40 $this->keepSemicolons = true; 41 } 42 43 /** 44 * {@inheritdoc} 45 */ 46 protected function indentStr() 47 { 48 return str_repeat(' ', $this->indentLevel); 49 } 50 51 /** 52 * {@inheritdoc} 53 */ 54 protected function blockLines(OutputBlock $block) 55 { 56 $indent = $this->indentStr(); 57 58 if (empty($block->lines)) { 59 $this->write("{$indent}block->lines: []\n"); 60 61 return; 62 } 63 64 foreach ($block->lines as $index => $line) { 65 $this->write("{$indent}block->lines[{$index}]: $line\n"); 66 } 67 } 68 69 /** 70 * {@inheritdoc} 71 */ 72 protected function blockSelectors(OutputBlock $block) 73 { 74 $indent = $this->indentStr(); 75 76 if (empty($block->selectors)) { 77 $this->write("{$indent}block->selectors: []\n"); 78 79 return; 80 } 81 82 foreach ($block->selectors as $index => $selector) { 83 $this->write("{$indent}block->selectors[{$index}]: $selector\n"); 84 } 85 } 86 87 /** 88 * {@inheritdoc} 89 */ 90 protected function blockChildren(OutputBlock $block) 91 { 92 $indent = $this->indentStr(); 93 94 if (empty($block->children)) { 95 $this->write("{$indent}block->children: []\n"); 96 97 return; 98 } 99 100 $this->indentLevel++; 101 102 foreach ($block->children as $i => $child) { 103 $this->block($child); 104 } 105 106 $this->indentLevel--; 107 } 108 109 /** 110 * {@inheritdoc} 111 */ 112 protected function block(OutputBlock $block) 113 { 114 $indent = $this->indentStr(); 115 116 $this->write("{$indent}block->type: {$block->type}\n" . 117 "{$indent}block->depth: {$block->depth}\n"); 118 119 $this->currentBlock = $block; 120 121 $this->blockSelectors($block); 122 $this->blockLines($block); 123 $this->blockChildren($block); 124 } 125 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body