public static function createObject($type)
    {
        if (\is_string($type)) {
            return static::get($type);
        } elseif (\is_array($type)) {
            if (!isset($type['class'])) {
                throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
            }

            $class = $type['class'];
            unset($type['class']);

            return static::get($class, $type);
        }

        throw new InvalidConfigException('Unsupported configuration type: ' . \gettype($type));
    }