Skip to content

Commit

Permalink
Alias feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ftaiolivista committed Oct 12, 2011
1 parent 22e0244 commit 041c3a7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Pimple.php
Expand Up @@ -145,4 +145,21 @@ function raw($id)

return $this->values[$id];
}

/**
* Sometimes is usefull to have properties/objects aliases
*
* @param string $src The unique identifier for existing the parameter or object
*
* @param string $dst The unique new alias
*
* @throws InvalidArgumentException if the identifier is not defined
*/
function alias($src, $dst){
if (!isset($this->values[$src])) {
throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id));
}
$this->values[$dst] &= $this->values[$src];
}

}

0 comments on commit 041c3a7

Please sign in to comment.