Skip to content

Commit

Permalink
Removed legacy key styles (array, arbitrary arguments)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Dec 14, 2015
1 parent 8935d3f commit 40ee61f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

* Added `Pool::deleteItem` and `Pool::deleteItems`.

* Removed legacy methods for defining keys- keys must be defined as strings.


## Stash v0.13 Changelog
Expand Down
23 changes: 3 additions & 20 deletions src/Stash/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,10 @@ public function setItemClass($class)
/**
* {@inheritdoc}
*/
public function getItem()
public function getItem($key)
{
$args = func_get_args();

if (!isset($args[0])) {
throw new \InvalidArgumentException('Item constructor requires a key.');
}

// check to see if a single array was used instead of multiple arguments
if (!isset($args[1]) && is_array($args[0])) {
$args = $args[0];
}

// if only one item treat as key string
if (!isset($args[1])) {
$keyString = trim($args[0], '/');
$key = explode('/', $keyString);
} else {
$key = $args;
}

$keyString = trim($key, '/');
$key = explode('/', $keyString);
$namespace = empty($this->namespace) ? 'stash_default' : $this->namespace;

array_unshift($key, $namespace);
Expand Down

0 comments on commit 40ee61f

Please sign in to comment.