public function addType(WidgetTypeInterface $widget)
    {
        if (!$this->hasType($widget)) {
            $this->types[$widget->getName()] = $widget;
        } else {
            throw new \InvalidArgumentException(sprintf('Widget type "%s" is already registered.', $widget->getName()));
        }
    }
public function addType(WidgetTypeInterface $widget)
    {
        if (!$this->hasType($widget)) {
            $this->types[$widget->getName()] = $widget;
        } else {
            throw new \InvalidArgumentException(sprintf('Widget type "%s" is already registered.', $widget->getName()));
        }
    }
public function addType ( WidgetTypeInterface $ widget ) { if ( ! $ this -> hasType ( $ widget ) ) { $ this -> types [ $ widget -> getName ( ) ] = $ widget ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Widget type "%s" is already registered.' , $ widget -> getName ( ) ) ) ; } }
Adds the widget type.

@param WidgetTypeInterface $widget
@throws \InvalidArgumentException
Adds the widget type .