original_string: public function remove($widgetCategoryId, $widgetName = false)
      {
          foreach ($this->widgets as $index => $widget) {
              if ($widget->getCategoryId() === $widgetCategoryId) {
                  if (!$widgetName || $widget->getName() === $widgetName) {
                      unset($this->widgets[$index]);
                  }
              }
          }
      }
code: public function remove($widgetCategoryId, $widgetName = false)
      {
          foreach ($this->widgets as $index => $widget) {
              if ($widget->getCategoryId() === $widgetCategoryId) {
                  if (!$widgetName || $widget->getName() === $widgetName) {
                      unset($this->widgets[$index]);
                  }
              }
          }
      }
code_tokens: public function remove ( $ widgetCategoryId , $ widgetName = false ) { foreach ( $ this -> widgets as $ index => $ widget ) { if ( $ widget -> getCategoryId ( ) === $ widgetCategoryId ) { if ( ! $ widgetName || $ widget -> getName ( ) === $ widgetName ) { unset ( $ this -> widgets [ $ index ] ) ; } } } }
docstring: Removes one or more widgets from the widget list.
  
  @param string $widgetCategoryId The widget category id. Can be a translation token eg 'General_Visits'
  see {@link WidgetConfig::setCategoryId()}.
  @param string|false $widgetName The name of the widget to remove eg 'VisitTime_ByServerTimeWidgetName'.
  If not supplied, all widgets within that category will be removed.
docstring_tokens: Removes one or more widgets from the widget list .