original_string: public function add_contextlist(contextlist_base $contextlist) {
          $component = $contextlist->get_component();
          if (empty($component)) {
              throw new \moodle_exception("The contextlist must have a component set");
          }
          if (isset($this->contextlists[$component])) {
              throw new \moodle_exception("A contextlist has already been added for the '{$component}' component");
          }
  
          $this->contextlists[$component] = $contextlist;
  
          return $this;
      }
code: public function add_contextlist(contextlist_base $contextlist) {
          $component = $contextlist->get_component();
          if (empty($component)) {
              throw new \moodle_exception("The contextlist must have a component set");
          }
          if (isset($this->contextlists[$component])) {
              throw new \moodle_exception("A contextlist has already been added for the '{$component}' component");
          }
  
          $this->contextlists[$component] = $contextlist;
  
          return $this;
      }
code_tokens: public function add_contextlist ( contextlist_base $ contextlist ) { $ component = $ contextlist -> get_component ( ) ; if ( empty ( $ component ) ) { throw new \ moodle_exception ( "The contextlist must have a component set" ) ; } if ( isset ( $ this -> contextlists [ $ component ] ) ) { throw new \ moodle_exception ( "A contextlist has already been added for the '{$component}' component" ) ; } $ this -> contextlists [ $ component ] = $ contextlist ; return $ this ; }
docstring: Add a contextlist to this collection.
  
  @param   contextlist_base $contextlist the contextlist to export.
  @return  $this
docstring_tokens: Add a contextlist to this collection .