original_string: public function add($text, moodle_url $url = null, $title = null, $sort = null) {
          $key = count($this->children);
          if (empty($sort)) {
              $sort = $this->lastsort + 1;
          }
          $this->children[$key] = new custom_menu_item($text, $url, $title, $sort, $this);
          $this->lastsort = (int)$sort;
          return $this->children[$key];
      }
code: public function add($text, moodle_url $url = null, $title = null, $sort = null) {
          $key = count($this->children);
          if (empty($sort)) {
              $sort = $this->lastsort + 1;
          }
          $this->children[$key] = new custom_menu_item($text, $url, $title, $sort, $this);
          $this->lastsort = (int)$sort;
          return $this->children[$key];
      }
code_tokens: public function add ( $ text , moodle_url $ url = null , $ title = null , $ sort = null ) { $ key = count ( $ this -> children ) ; if ( empty ( $ sort ) ) { $ sort = $ this -> lastsort + 1 ; } $ this -> children [ $ key ] = new custom_menu_item ( $ text , $ url , $ title , $ sort , $ this ) ; $ this -> lastsort = ( int ) $ sort ; return $ this -> children [ $ key ] ; }
docstring: Adds a custom menu item as a child of this node given its properties.
  
  @param string $text
  @param moodle_url $url
  @param string $title
  @param int $sort
  @return custom_menu_item
docstring_tokens: Adds a custom menu item as a child of this node given its properties .