original_string: protected function get_flag_html($flagged, $id = '') {
          if ($flagged) {
              $icon = 'i/flagged';
              $alt = get_string('flagged', 'question');
          } else {
              $icon = 'i/unflagged';
              $alt = get_string('notflagged', 'question');
          }
          $attributes = array(
              'src' => $this->image_url($icon),
              'alt' => $alt,
          );
          if ($id) {
              $attributes['id'] = $id;
          }
          $img = html_writer::empty_tag('img', $attributes);
          if ($flagged) {
              $img .= ' ' . get_string('flagged', 'question');
          }
          return $img;
      }
code: protected function get_flag_html($flagged, $id = '') {
          if ($flagged) {
              $icon = 'i/flagged';
              $alt = get_string('flagged', 'question');
          } else {
              $icon = 'i/unflagged';
              $alt = get_string('notflagged', 'question');
          }
          $attributes = array(
              'src' => $this->image_url($icon),
              'alt' => $alt,
          );
          if ($id) {
              $attributes['id'] = $id;
          }
          $img = html_writer::empty_tag('img', $attributes);
          if ($flagged) {
              $img .= ' ' . get_string('flagged', 'question');
          }
          return $img;
      }
code_tokens: protected function get_flag_html ( $ flagged , $ id = '' ) { if ( $ flagged ) { $ icon = 'i/flagged' ; $ alt = get_string ( 'flagged' , 'question' ) ; } else { $ icon = 'i/unflagged' ; $ alt = get_string ( 'notflagged' , 'question' ) ; } $ attributes = array ( 'src' => $ this -> image_url ( $ icon ) , 'alt' => $ alt , ) ; if ( $ id ) { $ attributes [ 'id' ] = $ id ; } $ img = html_writer :: empty_tag ( 'img' , $ attributes ) ; if ( $ flagged ) { $ img .= ' ' . get_string ( 'flagged' , 'question' ) ; } return $ img ; }
docstring: Work out the actual img tag needed for the flag
  
  @param bool $flagged whether the question is currently flagged.
  @param string $id an id to be added as an attribute to the img (optional).
  @return string the img tag.
docstring_tokens: Work out the actual img tag needed for the flag