public function share($id, $value, array $tags = [])
{
if (!is_callable($value)) {
throw new \InvalidArgumentException("Only callable values can be shared in the container");
}
$value = function ($container) use($value) {
static $sharedValue;
if (null === $sharedValue) {
$sharedValue = $value($container);
}
return $sharedValue;
};
$this->set($id, $value, $tags);
}