| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * SCSSPHP |
| 4 | 4 | * |
| 5 | - * @copyright 2012-2018 Leaf Corcoran | |
| 5 | + * @copyright 2012-2015 Leaf Corcoran | |
| 6 | 6 | * |
| 7 | 7 | * @license http://opensource.org/licenses/MIT MIT |
| 8 | 8 | * |
| 9 | 9 | * @link http://leafo.github.io/scssphp |
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | use Leafo\ScssPhp\Formatter; |
| 15 | 15 | use Leafo\ScssPhp\Formatter\OutputBlock; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * Nested formatter | |
| 18 | + * SCSS nested formatter | |
| 19 | 19 | * |
| 20 | 20 | * @author Leaf Corcoran <[email protected]> |
| 21 | 21 | */ |
| 22 | 22 | class Nested extends Formatter |
| @@ -37,9 +37,8 @@ | ||
| 37 | 37 | $this->open = ' {'; |
| 38 | 38 | $this->close = ' }'; |
| 39 | 39 | $this->tagSeparator = ', '; |
| 40 | 40 | $this->assignSeparator = ': '; |
| 41 | - $this->keepSemicolons = true; | |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | /** |
| 45 | 44 | * {@inheritdoc} |
| @@ -65,12 +64,12 @@ | ||
| 65 | 64 | $block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line); |
| 66 | 65 | } |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | - $this->write($inner . implode($glue, $block->lines)); | |
| 68 | + echo $inner . implode($glue, $block->lines); | |
| 70 | 69 | |
| 71 | 70 | if (! empty($block->children)) { |
| 72 | - $this->write($this->break); | |
| 71 | + echo $this->break; | |
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | /** |
| @@ -79,11 +78,11 @@ | ||
| 79 | 78 | protected function blockSelectors(OutputBlock $block) |
| 80 | 79 | { |
| 81 | 80 | $inner = $this->indentStr(); |
| 82 | 81 | |
| 83 | - $this->write($inner | |
| 82 | + echo $inner | |
| 84 | 83 | . implode($this->tagSeparator, $block->selectors) |
| 85 | - . $this->open . $this->break); | |
| 84 | + . $this->open . $this->break; | |
| 86 | 85 | } |
| 87 | 86 | |
| 88 | 87 | /** |
| 89 | 88 | * {@inheritdoc} |
| @@ -93,15 +92,15 @@ | ||
| 93 | 92 | foreach ($block->children as $i => $child) { |
| 94 | 93 | $this->block($child); |
| 95 | 94 | |
| 96 | 95 | if ($i < count($block->children) - 1) { |
| 97 | - $this->write($this->break); | |
| 96 | + echo $this->break; | |
| 98 | 97 | |
| 99 | 98 | if (isset($block->children[$i + 1])) { |
| 100 | 99 | $next = $block->children[$i + 1]; |
| 101 | 100 | |
| 102 | 101 | if ($next->depth === max($block->depth, 1) && $child->depth >= $next->depth) { |
| 103 | - $this->write($this->break); | |
| 102 | + echo $this->break; | |
| 104 | 103 | } |
| 105 | 104 | } |
| 106 | 105 | } |
| 107 | 106 | } |
| @@ -119,11 +118,8 @@ | ||
| 119 | 118 | if (empty($block->lines) && empty($block->children)) { |
| 120 | 119 | return; |
| 121 | 120 | } |
| 122 | 121 | |
| 123 | - $this->currentBlock = $block; | |
| 124 | - | |
| 125 | - | |
| 126 | 122 | $this->depth = $block->depth; |
| 127 | 123 | |
| 128 | 124 | if (! empty($block->selectors)) { |
| 129 | 125 | $this->blockSelectors($block); |
| @@ -141,13 +137,13 @@ | ||
| 141 | 137 | |
| 142 | 138 | if (! empty($block->selectors)) { |
| 143 | 139 | $this->indentLevel--; |
| 144 | 140 | |
| 145 | - $this->write($this->close); | |
| 141 | + echo $this->close; | |
| 146 | 142 | } |
| 147 | 143 | |
| 148 | 144 | if ($block->type === 'root') { |
| 149 | - $this->write($this->break); | |
| 145 | + echo $this->break; | |
| 150 | 146 | } |
| 151 | 147 | } |
| 152 | 148 | |
| 153 | 149 | /** |
| @@ -157,9 +153,9 @@ | ||
| 157 | 153 | */ |
| 158 | 154 | private function adjustAllChildren(OutputBlock $block) |
| 159 | 155 | { |
| 160 | 156 | // flatten empty nested blocks |
| 161 | - $children = []; | |
| 157 | + $children = array(); | |
| 162 | 158 | |
| 163 | 159 | foreach ($block->children as $i => $child) { |
| 164 | 160 | if (empty($child->lines) && empty($child->children)) { |
| 165 | 161 | if (isset($block->children[$i + 1])) { |