From d49cecf40a1f1895eda011b316ef4b8e59906441 Mon Sep 17 00:00:00 2001 From: Andreus Timm Date: Wed, 14 Oct 2015 14:24:18 -0300 Subject: [PATCH] Improvement with rtrim --- PHPCI/Plugin/PhpCpd.php | 2 +- PHPCI/Plugin/PhpLoc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php index 953c3ea7..125e13eb 100644 --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -74,7 +74,7 @@ class PhpCpd implements \PHPCI\Plugin if (count($this->ignore)) { $map = function ($item) { // remove the trailing slash - $item = (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); + $item = rtrim($item, '/'); if (is_file($this->path . '/' . $item)) { return ' --names-exclude ' . $item; diff --git a/PHPCI/Plugin/PhpLoc.php b/PHPCI/Plugin/PhpLoc.php index 76887493..eb5af6ff 100644 --- a/PHPCI/Plugin/PhpLoc.php +++ b/PHPCI/Plugin/PhpLoc.php @@ -71,7 +71,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $ignore = ''; if (count($this->phpci->ignore)) { $map = function ($item) { - return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item); + return ' --exclude ' . rtrim($item, '/'); }; $ignore = array_map($map, $this->phpci->ignore);