*/
public static function getApp()
{
- return self::$dice->create(App::class);
+ return self::getClass(App::class);
}
/**
*/
public static function getClass(string $name)
{
- if (class_exists($name) || interface_exists($name )) {
+ if (empty(self::$dice)) {
+ throw new InternalServerErrorException('DICE isn\'t initialized.');
+ }
+
+ if (class_exists($name) || interface_exists($name)) {
return self::$dice->create($name);
} else {
throw new InternalServerErrorException('Class \'' . $name . '\' isn\'t valid.');