ParserUtils
Internal utility methods for color string parsing.
Methods
between
static
public static function between(string $haystack, string $start, string $end): string
Extract content between two substrings.
Parameters
| Name | Type | Default |
|---|---|---|
$haystack |
string | - |
$start |
string | - |
$end |
string | - |
normalizeSpaceName
static
public static function normalizeSpaceName(string $space): string
Normalize a color space name.
Parameters
| Name | Type | Default |
|---|---|---|
$space |
string | - |
parseUnitOrPercent
static
public static function parseUnitOrPercent(string $token): float
Parse a numeric value or percentage into a float in range [0, 1].
Parameters
| Name | Type | Default |
|---|---|---|
$token |
string | - |
splitBySlashOutsideParens
static
public static function splitBySlashOutsideParens(string $str): array
Split a string by slash only if it is outside of parentheses.
Parameters
| Name | Type | Default |
|---|---|---|
$str |
string | - |
splitChannelExpressions
static
public static function splitChannelExpressions(string $channelPart): array
Split channel expressions by whitespace, respecting parentheses.
Parameters
| Name | Type | Default |
|---|---|---|
$channelPart |
string | - |