original_string: public function get_pin_discussion_url_from_discussion(discussion_entity $discussion) : moodle_url {
          return new moodle_url('discuss.php', [
              'sesskey' => sesskey(),
              'd' => $discussion->get_id(),
              'pin' => $discussion->is_pinned() ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_PINNED
          ]);
      }
code: public function get_pin_discussion_url_from_discussion(discussion_entity $discussion) : moodle_url {
          return new moodle_url('discuss.php', [
              'sesskey' => sesskey(),
              'd' => $discussion->get_id(),
              'pin' => $discussion->is_pinned() ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_PINNED
          ]);
      }
code_tokens: public function get_pin_discussion_url_from_discussion ( discussion_entity $ discussion ) : moodle_url { return new moodle_url ( 'discuss.php' , [ 'sesskey' => sesskey ( ) , 'd' => $ discussion -> get_id ( ) , 'pin' => $ discussion -> is_pinned ( ) ? FORUM_DISCUSSION_UNPINNED : FORUM_DISCUSSION_PINNED ] ) ; }
docstring: Generate the pinned discussion link
  
  @param discussion_entity $discussion
  @return moodle_url
  @throws \moodle_exception
docstring_tokens: Generate the pinned discussion link