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
224
224
225
225
public function render (OutputFormat $ outputFormat ): string
226
226
{
227
- // Shorthand RGB color values
228
- if (
229
- $ outputFormat ->getRGBHashNotation ()
230
- && $ this ->getRealName () === 'rgb '
231
- && $ this ->allComponentsAreNumbers ()
232
- ) {
227
+ if ($ this ->shouldRenderAsHex ($ outputFormat )) {
233
228
return $ this ->renderAsHex ();
234
229
}
235
230
@@ -240,6 +235,14 @@ public function render(OutputFormat $outputFormat): string
240
235
return parent ::render ($ outputFormat );
241
236
}
242
237
238
+ private function shouldRenderAsHex (OutputFormat $ outputFormat ): bool
239
+ {
240
+ return
241
+ $ outputFormat ->getRGBHashNotation ()
242
+ && $ this ->getRealName () === 'rgb '
243
+ && $ this ->allComponentsAreNumbers ();
244
+ }
245
+
243
246
/**
244
247
* The function name is a concatenation of the array keys of the components, which is passed to the constructor.
245
248
* However, this can be changed by calling {@see CSSFunction::setName},
You can’t perform that action at this time.
0 commit comments