Skip to content

Commit

Permalink
Merge pull request #4731 from jeromegamez/always-true
Browse files Browse the repository at this point in the history
Remove explicit condition that is always true
  • Loading branch information
samsonasik authored May 24, 2021
2 parents 1f67e38 + 1e5b7d0 commit 5c6f396
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions system/Helpers/text_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function ascii_to_entities(string $str): string
*/
if (count($temp) === 1)
{
$out .= '&#' . array_shift($temp) . ';';
$out .= '&#' . array_shift($temp) . ';';
$count = 1;
}

Expand All @@ -140,9 +140,9 @@ function ascii_to_entities(string $str): string
if (count($temp) === $count)
{
$number = ($count === 3) ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) : (($temp[0] % 32) * 64) + ($temp[1] % 64);
$out .= '&#' . $number . ';';
$count = 1;
$temp = [];
$out .= '&#' . $number . ';';
$count = 1;
$temp = [];
}
// If this is the last iteration, just output whatever we have
elseif ($i === $s)
Expand Down Expand Up @@ -486,7 +486,7 @@ function word_wrap(string $str, int $charlim = 76): string
}
// Trim the word down
$temp .= mb_substr($line, 0, $charlim - 1);
$line = mb_substr($line, $charlim - 1);
$line = mb_substr($line, $charlim - 1);
}

// If $temp contains data it means we had to split up an over-length
Expand Down Expand Up @@ -811,14 +811,14 @@ function excerpt(string $text, string $phrase = null, int $radius = 100, string
$phrasePos = stripos($text, $phrase);
$phraseLen = strlen($phrase);
}
elseif (! isset($phrase))
else
{
$phrasePos = $radius / 2;
$phraseLen = 1;
}

$pre = explode(' ', substr($text, 0, $phrasePos)); // @phpstan-ignore-line
$pos = explode(' ', substr($text, $phrasePos + $phraseLen)); // @phpstan-ignore-line
$pre = explode(' ', substr($text, 0, $phrasePos));
$pos = explode(' ', substr($text, $phrasePos + $phraseLen));

$prev = ' ';
$post = ' ';
Expand Down

0 comments on commit 5c6f396

Please sign in to comment.