From 765c16ac182d04c0161edfd990ef5da3f908d687 Mon Sep 17 00:00:00 2001 From: Tomas Saghy Date: Tue, 12 Dec 2017 11:01:16 +0100 Subject: [PATCH] fix countItems to have the same api --- src/Cart.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Cart.php b/src/Cart.php index f045b40..37fd177 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -181,11 +181,13 @@ public function isEmptyByType($type) /** * Get items count. * + * @param callable|null $filter + * * @return int */ - public function countItems() + public function countItems($filter = null) { - return count($this->getItems()); + return count($this->getItems($filter)); } /** @@ -197,7 +199,7 @@ public function countItems() */ public function countItemsByType($type) { - return count($this->getItemsByType($type)); + return $this->countItems($this->_getTypeCondition($type)); } /**