Skip to content

Instantly share code, notes, and snippets.

@geggleto
Created August 15, 2016 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geggleto/86d039f6f4924b416e6fb1bd1538e269 to your computer and use it in GitHub Desktop.
Save geggleto/86d039f6f4924b416e6fb1bd1538e269 to your computer and use it in GitHub Desktop.
public function get($id)
{
if (!$this->offsetExists($id)) {
throw new ContainerValueNotFoundException(sprintf('Identifier "%s" is not defined.', $id));
}
try {
return $this->offsetGet($id);
} catch (\InvalidArgumentException $exception) {
if ($this->exceptionThrownByContainer($exception)) {
throw new SlimContainerException(
sprintf('Container error while retrieving "%s"', $id),
null,
$exception
);
} else {
throw $exception;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment