original_string: public function get_rate_url($rating = null, $returnurl = null) {
          if (empty($returnurl)) {
              if (!empty($this->settings->returnurl)) {
                  $returnurl = $this->settings->returnurl;
              } else {
                  global $PAGE;
                  $returnurl = $PAGE->url;
              }
          }
          $args = array(
              'contextid'   => $this->context->id,
              'component'   => $this->component,
              'ratingarea'  => $this->ratingarea,
              'itemid'      => $this->itemid,
              'scaleid'     => $this->settings->scale->id,
              'returnurl'   => $returnurl,
              'rateduserid' => $this->itemuserid,
              'aggregation' => $this->settings->aggregationmethod,
              'sesskey'     => sesskey()
          );
          if (!empty($rating)) {
              $args['rating'] = $rating;
          }
          $url = new moodle_url('/rating/rate.php', $args);
          return $url;
      }
code: public function get_rate_url($rating = null, $returnurl = null) {
          if (empty($returnurl)) {
              if (!empty($this->settings->returnurl)) {
                  $returnurl = $this->settings->returnurl;
              } else {
                  global $PAGE;
                  $returnurl = $PAGE->url;
              }
          }
          $args = array(
              'contextid'   => $this->context->id,
              'component'   => $this->component,
              'ratingarea'  => $this->ratingarea,
              'itemid'      => $this->itemid,
              'scaleid'     => $this->settings->scale->id,
              'returnurl'   => $returnurl,
              'rateduserid' => $this->itemuserid,
              'aggregation' => $this->settings->aggregationmethod,
              'sesskey'     => sesskey()
          );
          if (!empty($rating)) {
              $args['rating'] = $rating;
          }
          $url = new moodle_url('/rating/rate.php', $args);
          return $url;
      }
code_tokens: public function get_rate_url ( $ rating = null , $ returnurl = null ) { if ( empty ( $ returnurl ) ) { if ( ! empty ( $ this -> settings -> returnurl ) ) { $ returnurl = $ this -> settings -> returnurl ; } else { global $ PAGE ; $ returnurl = $ PAGE -> url ; } } $ args = array ( 'contextid' => $ this -> context -> id , 'component' => $ this -> component , 'ratingarea' => $ this -> ratingarea , 'itemid' => $ this -> itemid , 'scaleid' => $ this -> settings -> scale -> id , 'returnurl' => $ returnurl , 'rateduserid' => $ this -> itemuserid , 'aggregation' => $ this -> settings -> aggregationmethod , 'sesskey' => sesskey ( ) ) ; if ( ! empty ( $ rating ) ) { $ args [ 'rating' ] = $ rating ; } $ url = new moodle_url ( '/rating/rate.php' , $ args ) ; return $ url ; }
docstring: Returns a URL that can be used to rate the associated item.
  
  @param int|null          $rating    The rating to give the item, if null then no rating param is added.
  @param moodle_url|string $returnurl The URL to return to.
  @return moodle_url can be used to rate the associated item.
docstring_tokens: Returns a URL that can be used to rate the associated item .