From 583789b9e3a72bab2fb33c763beffa760e40e988 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Mon, 29 Sep 2014 13:08:57 +0200 Subject: [PATCH] Simplify tidy --- src/Stringy.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Stringy.php b/src/Stringy.php index 9f887b8..af3dedc 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -380,11 +380,17 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess */ public function tidy() { - $str = $this->str; - $str = preg_replace('/\x{2026}/u', '...', $str); - $str = preg_replace('/[\x{201C}\x{201D}]/u', '"', $str); - $str = preg_replace('/[\x{2018}\x{2019}]/u', "'", $str); - $str = preg_replace('/[\x{2013}\x{2014}]/u', '-', $str); + $str = preg_replace(array( + '/\x{2026}/u', + '/[\x{201C}\x{201D}]/u', + '/[\x{2018}\x{2019}]/u', + '/[\x{2013}\x{2014}]/u', + ), array( + '...', + '"', + "'", + '-', + ), $this->str); return self::create($str, $this->encoding); }