Skip to content

Commit

Permalink
Merge pull request #141 from guisaldanha/master
Browse files Browse the repository at this point in the history
Fix in convertHexToRGB method. PHP 8.1 does not allow the input strin…
  • Loading branch information
jdecool authored May 6, 2022
2 parents b0d4b73 + 0558ed1 commit 80d981e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Core/ImageWorkshopLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ public static function calculatePositions($containerWidth, $containerHeight, $la
/**
* Convert Hex color to RGB color format
*
* @param string $hex
* @param string|null $hex
*
* @return array
*/
public static function convertHexToRGB($hex)
{
return array(
'R' => (int) base_convert(substr($hex, 0, 2), 16, 10),
'G' => (int) base_convert(substr($hex, 2, 2), 16, 10),
'B' => (int) base_convert(substr($hex, 4, 2), 16, 10),
'R' => (int) base_convert(substr($hex ?? '', 0, 2), 16, 10),
'G' => (int) base_convert(substr($hex ?? '', 2, 2), 16, 10),
'B' => (int) base_convert(substr($hex ?? '', 4, 2), 16, 10),
);
}

Expand Down

0 comments on commit 80d981e

Please sign in to comment.