protected function _resolveWidget($widget)
    {
        $type = gettype($widget);
        if ($type === 'object') {
            return $widget;
        }

        if ($type === 'string') {
            $widget = [$widget];
        }

        $class = array_shift($widget);
        $className = App::className($class, 'View/Widget', 'Widget');
        if ($className === false || !class_exists($className)) {
            throw new RuntimeException(sprintf('Unable to locate widget class "%s"', $class));
        }
        if ($type === 'array' && count($widget)) {
            $reflection = new ReflectionClass($className);
            $arguments = [$this->_templates];
            foreach ($widget as $requirement) {
                $arguments[] = $this->get($requirement);
            }
            $instance = $reflection->newInstanceArgs($arguments);
        } else {
            $instance = new $className($this->_templates);
        }
        if (!($instance instanceof WidgetInterface)) {
            throw new RuntimeException(sprintf('"%s" does not implement the WidgetInterface', $className));
        }

        return $instance;
    }