Here is a function definition of Set Helper
class
public function singleton($key, $value)
{
$this->set($key, function ($c) use ($value) {
static $object;
if (null === $object) {
$object = $value($c);
}
return $object;
});
}
and in this class the above mentioned function will be called like
// Default environment
$this->container->singleton('environment', function ($c) {
return \Slim\Environment::getInstance();
});
where $this->container
represents the Set
helper class.