public function count($totalItems = true)
    {
        $items = $this->getCart();

        if (!$totalItems) {
            return $items->count();
        }

        $count = 0;

        foreach ($items as $row) {
            $count += $row->qty;
        }

        return $count;
    }
public function count($totalItems = true)
    {
        $items = $this->getCart();

        if (!$totalItems) {
            return $items->count();
        }

        $count = 0;

        foreach ($items as $row) {
            $count += $row->qty;
        }

        return $count;
    }
public function count ( $ totalItems = true ) { $ items = $ this -> getCart ( ) ; if ( ! $ totalItems ) { return $ items -> count ( ) ; } $ count = 0 ; foreach ( $ items as $ row ) { $ count += $ row -> qty ; } return $ count ; }
Get the number of items in the cart.

@param bool $totalItems Get all the items (when false, will return the number of rows)

@return int
Get the number of items in the cart .