original_string: public function add_item($key, $title, moodle_url $url, $method) {
          if (isset($this->items[$key])) {
              throw new coding_exception('Menu item already exists');
          }
          if (empty($title) or empty($key)) {
              throw new coding_exception('Empty title or item key not allowed');
          }
          $item = new stdclass();
          $item->title = $title;
          $item->url = $url;
          $item->method = $method;
          $this->items[$key] = $item;
      }
code: public function add_item($key, $title, moodle_url $url, $method) {
          if (isset($this->items[$key])) {
              throw new coding_exception('Menu item already exists');
          }
          if (empty($title) or empty($key)) {
              throw new coding_exception('Empty title or item key not allowed');
          }
          $item = new stdclass();
          $item->title = $title;
          $item->url = $url;
          $item->method = $method;
          $this->items[$key] = $item;
      }
code_tokens: public function add_item ( $ key , $ title , moodle_url $ url , $ method ) { if ( isset ( $ this -> items [ $ key ] ) ) { throw new coding_exception ( 'Menu item already exists' ) ; } if ( empty ( $ title ) or empty ( $ key ) ) { throw new coding_exception ( 'Empty title or item key not allowed' ) ; } $ item = new stdclass ( ) ; $ item -> title = $ title ; $ item -> url = $ url ; $ item -> method = $ method ; $ this -> items [ $ key ] = $ item ; }
docstring: Adds item into the menu
  
  @param string $key item identifier
  @param string $title localized action title
  @param moodle_url $url action handler
  @param string $method form method
docstring_tokens: Adds item into the menu