From 3f02443c1f3e76ebd949a2322f4b2d3fe40c26f2 Mon Sep 17 00:00:00 2001 From: Dmitry Demidovsky Date: Sat, 5 Dec 2015 17:51:58 +0300 Subject: [PATCH] Added rtrim, removed preg_match --- lib/Minify/Source/Factory.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/Minify/Source/Factory.php b/lib/Minify/Source/Factory.php index 4f28d0e..cc3648a 100644 --- a/lib/Minify/Source/Factory.php +++ b/lib/Minify/Source/Factory.php @@ -112,20 +112,15 @@ class Minify_Source_Factory { /** - * @param string $path + * @param string $path * @return string */ public function getNormalizedPath($path) { - // turn windows-style slashes into unix-style - $norm = str_replace("\\", "/", $path); - - // lowercase drive letter - if (preg_match('/^\w:/', $norm)) { - $norm = lcfirst($norm); - } - - return $norm; + // turn windows-style slashes into unix-style, + // remove trailing slash + // and lowercase drive letter + return lcfirst(rtrim(str_replace('\\', '/', $path), '/')); }