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];
    }
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];
    }
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 ] ; }
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
Adds a custom menu item as a child of this node given its properties .