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)); } /**