From 2d9865f1d3c3a63a7a34a625951580e502bbe221 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 14 Sep 2014 00:29:57 +0200 Subject: [PATCH] Fixed unused variable in abstract search service --- src/Dao/Services/AbstractSearchService.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Dao/Services/AbstractSearchService.php b/src/Dao/Services/AbstractSearchService.php index 80701584..4f0a8152 100644 --- a/src/Dao/Services/AbstractSearchService.php +++ b/src/Dao/Services/AbstractSearchService.php @@ -76,19 +76,13 @@ abstract class AbstractSearchService foreach ($tokens as $token) { $token = preg_split('/,|\s+/', $token); - if (count($token) === 2) - { - $orderDir = $token[1] === 'desc' ? self::ORDER_DESC : self::ORDER_ASC; - $orderToken = $token[0]; - } - else - { - $orderDir = self::ORDER_ASC; - $orderToken = $token; - } - $orderColumn = $this->getOrderColumn($token[0]); + $orderToken = $token[0]; + $orderDir = (count($token) === 2 and $token[1] === 'desc') ? self::ORDER_DESC : self::ORDER_ASC; + + $orderColumn = $this->getOrderColumn($orderToken); if ($orderColumn === null) - throw new \InvalidArgumentException('Invalid search order token: ' . $token); + throw new \InvalidArgumentException('Invalid search order token: ' . $orderToken); + $order[$orderColumn] = $orderDir; } $defaultOrderColumn = $this->getDefaultOrderColumn();