Skip to content

Commit 3da1e99

Browse files
committed
fix: Fixed an issue with Craft ^5.9 where it throws an error because craftcms/cms no longer uses the Stringy package ([#349](#349))
1 parent 4e5fd19 commit 3da1e99

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/helpers/Text.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace nystudio107\retour\helpers;
1313

1414
use craft\helpers\StringHelper;
15-
use Stringy\Stringy;
1615

1716
/**
1817
* @author nystudio107
@@ -44,7 +43,7 @@ public static function truncate(string $string, int $length, string $substring =
4443

4544
if (!empty($string)) {
4645
$string = strip_tags($string);
47-
$result = (string)Stringy::create($string)->truncate($length, $substring);
46+
$result = StringHelper::truncate($string, $length, $substring);
4847
}
4948

5049
return $result;
@@ -68,7 +67,7 @@ public static function truncateOnWord(string $string, int $length, string $subst
6867

6968
if (!empty($string)) {
7069
$string = strip_tags($string);
71-
$result = (string)Stringy::create($string)->safeTruncate($length, $substring);
70+
$result = StringHelper::safeTruncate($string, $length, $substring);
7271
}
7372

7473
return $result;

0 commit comments

Comments
 (0)