From e401f7e0dfa6f2d508b61b213329b14d11352ce7 Mon Sep 17 00:00:00 2001 From: Anton Komarev Date: Thu, 12 Oct 2023 00:21:21 +0300 Subject: [PATCH] Code style fix --- src/Calculator/SvgTextSizeCalculator.php | 2 +- src/Calculator/TextUnicodeConverter.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Calculator/SvgTextSizeCalculator.php b/src/Calculator/SvgTextSizeCalculator.php index 3881bd1..9e16454 100644 --- a/src/Calculator/SvgTextSizeCalculator.php +++ b/src/Calculator/SvgTextSizeCalculator.php @@ -35,7 +35,7 @@ public function calculateWidth(string $text, int $size = self::TEXT_SIZE): float $lineWidth = 0; foreach ($textUnicode as $unicodeCodePoint) { - if ($unicodeCodePoint === self::UNICODE_CODE_POINT_LINE_FEED) { + if (self::UNICODE_CODE_POINT_LINE_FEED === $unicodeCodePoint) { $width = \max($width, $lineWidth); $lineWidth = 0; continue; diff --git a/src/Calculator/TextUnicodeConverter.php b/src/Calculator/TextUnicodeConverter.php index 600121c..3b0cb4a 100644 --- a/src/Calculator/TextUnicodeConverter.php +++ b/src/Calculator/TextUnicodeConverter.php @@ -14,7 +14,7 @@ /** * @author Anton Komarev */ -final class TextUnicodeConverter +class TextUnicodeConverter { /** * Converts UTF-8 encoded string and returns unicode code points for every character. @@ -39,7 +39,7 @@ public static function convertTextToCodePoints( $values[] = $thisValue; if (\count($values) === $lookingFor) { - $number = ($lookingFor === 3) + $number = (3 === $lookingFor) ? (($values[0] % 16) * 4096) + (($values[1] % 64) * 64) + ($values[2] % 64) : (($values[0] % 32) * 64) + ($values[1] % 64);