Skip to content

Commit

Permalink
fix countItems to have the same api
Browse files Browse the repository at this point in the history
  • Loading branch information
segy committed Dec 12, 2017
1 parent cb03606 commit 765c16a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -197,7 +199,7 @@ public function countItems()
*/
public function countItemsByType($type)
{
return count($this->getItemsByType($type));
return $this->countItems($this->_getTypeCondition($type));
}

/**
Expand Down

0 comments on commit 765c16a

Please # to comment.