diff options
author | Andreas Gohr <andi@splitbrain.org> | 2023-09-02 14:42:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-02 14:42:51 +0200 |
commit | 5ff5424d8c81c7123d8656a787af2ff85b3dec21 (patch) | |
tree | 322929ee01d892bb3c927e7fe1238369c647f820 /inc/Utf8/PhpString.php | |
parent | 0613df3287b82a98b1e97cf86ed9d4c8fbd16f1c (diff) | |
parent | 91560755291852b8302767d454183a7662666f7e (diff) | |
download | dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.tar.gz dokuwiki-5ff5424d8c81c7123d8656a787af2ff85b3dec21.zip |
Merge pull request #4045 from dokuwiki/autofix
Use Rector to autofix code smell
Diffstat (limited to 'inc/Utf8/PhpString.php')
-rw-r--r-- | inc/Utf8/PhpString.php | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/inc/Utf8/PhpString.php b/inc/Utf8/PhpString.php index d382f14aa..6d9a8d547 100644 --- a/inc/Utf8/PhpString.php +++ b/inc/Utf8/PhpString.php @@ -7,7 +7,6 @@ namespace dokuwiki\Utf8; */ class PhpString { - /** * A locale independent basename() implementation * @@ -138,29 +137,21 @@ class PhpString if ($length === null) { $length_pattern = '(.*)$'; // the rest of the string } else { - if (!isset($strlen)) $strlen = self::strlen($str); // see notes if ($offset > $strlen) return ''; // another trivial case if ($length > 0) { - // reduce any length that would go past the end of the string $length = min($strlen - $offset, $length); - $Lx = (int)($length / 65535); $Ly = $length % 65535; - // +ve length requires ... a captured group of length characters if ($Lx) $length_pattern = '(?:.{65535}){' . $Lx . '}'; $length_pattern = '(' . $length_pattern . '.{' . $Ly . '})'; - - } else if ($length < 0) { - + } elseif ($length < 0) { if ($length < ($offset - $strlen)) return ''; - $Lx = (int)((-$length) / 65535); $Ly = (-$length) % 65535; - // -ve length requires ... capture everything except a group of -length characters // anchored at the tail-end of the string if ($Lx) $length_pattern = '(?:.{65535}){' . $Lx . '}'; @@ -268,7 +259,7 @@ class PhpString */ public static function strtolower($string) { - if($string === null) return ''; // pre-8.1 behaviour + if ($string === null) return ''; // pre-8.1 behaviour if (UTF8_MBSTRING) { if (class_exists('Normalizer', $autoload = false)) { return \Normalizer::normalize(mb_strtolower($string, 'utf-8')); @@ -379,6 +370,4 @@ class PhpString return $length; } - - } |