|
|
@@ -20,6 +20,7 @@ use Cake\View\StringTemplate;
|
|
|
use Cake\View\View;
|
|
|
use Cake\View\Widget\WidgetInterface;
|
|
|
use ReflectionClass;
|
|
|
+use RuntimeException;
|
|
|
|
|
|
/**
|
|
|
* A registry/factory for input widgets.
|
|
|
@@ -118,7 +119,7 @@ class WidgetRegistry
|
|
|
if (gettype($object) === 'object' &&
|
|
|
!($object instanceof WidgetInterface)
|
|
|
) {
|
|
|
- throw new \RuntimeException(
|
|
|
+ throw new RuntimeException(
|
|
|
'Widget objects must implement Cake\View\Widget\WidgetInterface.'
|
|
|
);
|
|
|
}
|
|
|
@@ -141,7 +142,7 @@ class WidgetRegistry
|
|
|
public function get($name)
|
|
|
{
|
|
|
if (!isset($this->_widgets[$name]) && empty($this->_widgets['_default'])) {
|
|
|
- throw new \RuntimeException(sprintf('Unknown widget "%s"', $name));
|
|
|
+ throw new RuntimeException(sprintf('Unknown widget "%s"', $name));
|
|
|
}
|
|
|
if (!isset($this->_widgets[$name])) {
|
|
|
$name = '_default';
|
|
|
@@ -182,7 +183,7 @@ class WidgetRegistry
|
|
|
$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));
|
|
|
+ throw new RuntimeException(sprintf('Unable to locate widget class "%s"', $class));
|
|
|
}
|
|
|
if ($type === 'array' && count($widget)) {
|
|
|
$reflection = new ReflectionClass($className);
|
|
|
@@ -195,7 +196,7 @@ class WidgetRegistry
|
|
|
$instance = new $className($this->_templates);
|
|
|
}
|
|
|
if (!($instance instanceof WidgetInterface)) {
|
|
|
- throw new \RuntimeException(sprintf('"%s" does not implement the WidgetInterface', $className));
|
|
|
+ throw new RuntimeException(sprintf('"%s" does not implement the WidgetInterface', $className));
|
|
|
}
|
|
|
return $instance;
|
|
|
}
|