Use PHP 8 'str_' functions.

A few more characters in some places, but helps with readability.
This commit is contained in:
wn_
2024-11-23 18:23:49 +00:00
parent 53fee911e6
commit 667528d5b9
32 changed files with 67 additions and 70 deletions

View File

@@ -221,7 +221,7 @@ function _color_hue2rgb(float $m1, float $m2, float $h): int {
* @return array{0: int, 1: int, 2: int}
*/
function _color_unpack(string $hex, bool $normalize = false): array {
$hex = strpos($hex, '#') !== 0 ? _resolve_htmlcolor($hex) : substr($hex, 1);
$hex = str_starts_with($hex, '#') ? substr($hex, 1) : _resolve_htmlcolor($hex);
if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];