Skip to content

Commit

Permalink
Finally we can unset the storage. Fixes #54.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-e committed May 27, 2013
1 parent dd64b17 commit 4ea917d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/class.storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,24 @@ public function setCount($items = array()) {
}

/**
* Drop given items from the storage.
* Drop given items from the storage. If the storage array
* becomes empty, unset it.
*
* @param array $items
* The items that should be dropped
**/
public function drop($items = array()) {
$this->dropFromArray($_SESSION[$this->_index], $items);
if (empty($_SESSION[$this->_index])) {
unset($_SESSION[$this->_index]);
}
}

/**
* Drop all items from the storage.
*/
public function dropAll() {
$_SESSION[$this->_index] = array();
unset($_SESSION[$this->_index]);
}

/**
Expand Down

0 comments on commit 4ea917d

Please sign in to comment.