1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-01-16 20:08:14 +01:00

Use normal replacement for @ in slugify

This commit is contained in:
Daniel St. Jules 2017-04-12 11:19:35 -04:00
parent eb13cc35d6
commit f22117862b
2 changed files with 2 additions and 1 deletions

View File

@ -1166,6 +1166,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
{
$stringy = $this->toAscii();
$stringy->str = str_replace('@', $replacement, $stringy);
$quotedReplacement = preg_quote($replacement);
$pattern = "/[^a-zA-Z\d\s-_$quotedReplacement]/u";
$stringy->str = preg_replace($pattern, '', $stringy);

View File

@ -1108,7 +1108,7 @@ class StringyTestCase extends PHPUnit_Framework_TestCase
['another-foo-bar', 'another..& foo -.-"-...bar'],
['foo-dbar', " Foo d'Bar "],
['a-string-with-dashes', 'A string-with-dashes'],
['userhost', 'user@host'],
['user-host', 'user@host'],
['using-strings-like-foo-bar', 'Using strings like fòô bàř'],
['numbers-1234', 'numbers 1234'],
['perevirka-ryadka', 'перевірка рядка'],