public function addWidget(WidgetInterface $widget)
    {
        if ($this->hasWidget($widget)) {
            throw new \InvalidArgumentException(sprintf('Widget "%s" is already registered.', $widget->getName()));
        }

        $this->widgets[$widget->getName()] = $widget;

        return $this;
    }
public function addWidget(WidgetInterface $widget)
    {
        if ($this->hasWidget($widget)) {
            throw new \InvalidArgumentException(sprintf('Widget "%s" is already registered.', $widget->getName()));
        }

        $this->widgets[$widget->getName()] = $widget;

        return $this;
    }
public function addWidget ( WidgetInterface $ widget ) { if ( $ this -> hasWidget ( $ widget ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Widget "%s" is already registered.' , $ widget -> getName ( ) ) ) ; } $ this -> widgets [ $ widget -> getName ( ) ] = $ widget ; return $ this ; }
Adds the widget.

@param WidgetInterface $widget
@return Dashboard
Adds the widget .