File tree Expand file tree Collapse file tree 7 files changed +22
-17
lines changed
Expand file tree Collapse file tree 7 files changed +22
-17
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ public function render(?OutputFormat $outputFormat = null): string
8686 if ($ outputFormat === null ) {
8787 $ outputFormat = new OutputFormat ();
8888 }
89- return $ outputFormat ->comments ($ this ) . $ this ->renderListContents ($ outputFormat );
89+ return $ outputFormat ->getFormatter ()-> comments ($ this ) . $ this ->renderListContents ($ outputFormat );
9090 }
9191
9292 public function isRootList (): bool
Original file line number Diff line number Diff line change @@ -61,8 +61,9 @@ public function __toString(): string
6161
6262 public function render (OutputFormat $ outputFormat ): string
6363 {
64- $ result = $ outputFormat ->comments ($ this );
65- $ result .= "@ {$ this ->vendorKeyFrame } {$ this ->animationName }{$ outputFormat ->spaceBeforeOpeningBrace ()}{ " ;
64+ $ formatter = $ outputFormat ->getFormatter ();
65+ $ result = $ formatter ->comments ($ this );
66+ $ result .= "@ {$ this ->vendorKeyFrame } {$ this ->animationName }{$ formatter ->spaceBeforeOpeningBrace ()}{ " ;
6667 $ result .= $ this ->renderListContents ($ outputFormat );
6768 $ result .= '} ' ;
6869 return $ result ;
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public function __toString(): string
8181
8282 public function render (OutputFormat $ outputFormat ): string
8383 {
84- return "{$ outputFormat ->comments ($ this )}@charset {$ this ->charset ->render ($ outputFormat )}; " ;
84+ return "{$ outputFormat ->getFormatter ()-> comments ($ this )}@charset {$ this ->charset ->render ($ outputFormat )}; " ;
8585 }
8686
8787 /**
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function __toString(): string
8282
8383 public function render (OutputFormat $ outputFormat ): string
8484 {
85- return $ outputFormat ->comments ($ this ) . '@import ' . $ this ->location ->render ($ outputFormat )
85+ return $ outputFormat ->getFormatter ()-> comments ($ this ) . '@import ' . $ this ->location ->render ($ outputFormat )
8686 . ($ this ->mediaQuery === null ? '' : ' ' . $ this ->mediaQuery ) . '; ' ;
8787 }
8888
Original file line number Diff line number Diff line change @@ -155,21 +155,23 @@ public function __toString(): string
155155 */
156156 public function render (OutputFormat $ outputFormat ): string
157157 {
158- $ result = $ outputFormat ->comments ($ this );
158+ $ formatter = $ outputFormat ->getFormatter ();
159+ $ result = $ formatter ->comments ($ this );
159160 if (\count ($ this ->selectors ) === 0 ) {
160161 // If all the selectors have been removed, this declaration block becomes invalid
161162 throw new OutputException ('Attempt to print declaration block with missing selector ' , $ this ->lineNumber );
162163 }
163164 $ result .= $ outputFormat ->getContentBeforeDeclarationBlock ();
164- $ result .= $ outputFormat ->implode (
165- $ outputFormat ->spaceBeforeSelectorSeparator () . ', ' . $ outputFormat ->spaceAfterSelectorSeparator (),
165+ $ result .= $ formatter ->implode (
166+ $ formatter ->spaceBeforeSelectorSeparator () . ', ' . $ formatter ->spaceAfterSelectorSeparator (),
166167 $ this ->selectors
167168 );
168169 $ result .= $ outputFormat ->getContentAfterDeclarationBlockSelectors ();
169- $ result .= $ outputFormat ->spaceBeforeOpeningBrace () . '{ ' ;
170+ $ result .= $ formatter ->spaceBeforeOpeningBrace () . '{ ' ;
170171 $ result .= $ this ->renderRules ($ outputFormat );
171172 $ result .= '} ' ;
172173 $ result .= $ outputFormat ->getContentAfterDeclarationBlock ();
174+
173175 return $ result ;
174176 }
175177}
Original file line number Diff line number Diff line change @@ -278,27 +278,29 @@ protected function renderRules(OutputFormat $outputFormat)
278278 $ isFirst = true ;
279279 $ nextLevelFormat = $ outputFormat ->nextLevel ();
280280 foreach ($ this ->getRules () as $ rule ) {
281- $ renderedRule = $ nextLevelFormat ->safely (static function () use ($ rule , $ nextLevelFormat ): string {
282- return $ rule ->render ($ nextLevelFormat );
283- });
281+ $ renderedRule = $ nextLevelFormat ->getFormatter ()
282+ ->safely (static function () use ($ rule , $ nextLevelFormat ): string {
283+ return $ rule ->render ($ nextLevelFormat );
284+ });
284285 if ($ renderedRule === null ) {
285286 continue ;
286287 }
287288 if ($ isFirst ) {
288289 $ isFirst = false ;
289- $ result .= $ nextLevelFormat ->spaceBeforeRules ();
290+ $ result .= $ nextLevelFormat ->getFormatter ()-> spaceBeforeRules ();
290291 } else {
291- $ result .= $ nextLevelFormat ->spaceBetweenRules ();
292+ $ result .= $ nextLevelFormat ->getFormatter ()-> spaceBetweenRules ();
292293 }
293294 $ result .= $ renderedRule ;
294295 }
295296
297+ $ formatter = $ outputFormat ->getFormatter ();
296298 if (!$ isFirst ) {
297299 // Had some output
298- $ result .= $ outputFormat ->spaceAfterRules ();
300+ $ result .= $ formatter ->spaceAfterRules ();
299301 }
300302
301- return $ outputFormat ->removeLastSemicolon ($ result );
303+ return $ formatter ->removeLastSemicolon ($ result );
302304 }
303305
304306 /**
Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ public function __construct(int $lineNumber = 0)
1818
1919 public function render (OutputFormat $ outputFormat ): string
2020 {
21- return $ outputFormat ->implode (' ' , $ this ->components );
21+ return $ outputFormat ->getFormatter ()-> implode (' ' , $ this ->components );
2222 }
2323}
You can’t perform that action at this time.
0 commit comments