Commit efcacdf4 by Shawn Barratt

v1.0.2

parent 395fec84
......@@ -18,31 +18,37 @@ class Container
public static function init(ContainerInterface $container)
{
if (self::$container) {
if (static::$container) {
throw new \Exception('Container has already been created');
}
self::$container = $container;
static::$container = $container;
}
public static function get($key)
{
$service = self::$container->get($key);
if (!static::$container) {
throw new \Exception('Container not initialized');
}
$service = static::$container->get($key);
return $service;
}
public static function has($key)
{
return self::$container->has($key);
if (!static::$container) {
throw new \Exception('Container not initialized');
}
return static::$container->has($key);
}
public static function getContainer()
{
return self::$container;
return static::$container;
}
public static function set($key, $callable)
{
return new \Exception('Adding the the instantiated container is not implemented');
return self::$container[$key] = $callable;
return static::$container[$key] = $callable;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment