File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -224,12 +224,7 @@ public function __toString(): string
224224
225225 public function render (OutputFormat $ outputFormat ): string
226226 {
227- // Shorthand RGB color values
228- if (
229- $ outputFormat ->getRGBHashNotation ()
230- && $ this ->getRealName () === 'rgb '
231- && $ this ->allComponentsAreNumbers ()
232- ) {
227+ if ($ this ->shouldRenderAsHex ($ outputFormat )) {
233228 return $ this ->renderAsHex ();
234229 }
235230
@@ -240,6 +235,14 @@ public function render(OutputFormat $outputFormat): string
240235 return parent ::render ($ outputFormat );
241236 }
242237
238+ private function shouldRenderAsHex (OutputFormat $ outputFormat ): bool
239+ {
240+ return
241+ $ outputFormat ->getRGBHashNotation ()
242+ && $ this ->getRealName () === 'rgb '
243+ && $ this ->allComponentsAreNumbers ();
244+ }
245+
243246 /**
244247 * The function name is a concatenation of the array keys of the components, which is passed to the constructor.
245248 * However, this can be changed by calling {@see CSSFunction::setName},
You can’t perform that action at this time.
0 commit comments