original_string: protected function replace_placeholders($template, subscription $subscription, $eventobj, $context) {
          $template = str_replace('{link}', $eventobj->link, $template);
          if ($eventobj->contextlevel == CONTEXT_MODULE && !empty($eventobj->contextinstanceid)
              && (strpos($template, '{modulelink}') !== false)) {
              $cm = get_fast_modinfo($eventobj->courseid)->get_cm($eventobj->contextinstanceid);
              $modulelink = $cm->url;
              $template = str_replace('{modulelink}', $modulelink, $template);
          }
          $template = str_replace('{rulename}', $subscription->get_name($context), $template);
          $template = str_replace('{description}', $subscription->get_description($context), $template);
          $template = str_replace('{eventname}', $subscription->get_event_name(), $template);
  
          return $template;
      }
code: protected function replace_placeholders($template, subscription $subscription, $eventobj, $context) {
          $template = str_replace('{link}', $eventobj->link, $template);
          if ($eventobj->contextlevel == CONTEXT_MODULE && !empty($eventobj->contextinstanceid)
              && (strpos($template, '{modulelink}') !== false)) {
              $cm = get_fast_modinfo($eventobj->courseid)->get_cm($eventobj->contextinstanceid);
              $modulelink = $cm->url;
              $template = str_replace('{modulelink}', $modulelink, $template);
          }
          $template = str_replace('{rulename}', $subscription->get_name($context), $template);
          $template = str_replace('{description}', $subscription->get_description($context), $template);
          $template = str_replace('{eventname}', $subscription->get_event_name(), $template);
  
          return $template;
      }
code_tokens: protected function replace_placeholders ( $ template , subscription $ subscription , $ eventobj , $ context ) { $ template = str_replace ( '{link}' , $ eventobj -> link , $ template ) ; if ( $ eventobj -> contextlevel == CONTEXT_MODULE && ! empty ( $ eventobj -> contextinstanceid ) && ( strpos ( $ template , '{modulelink}' ) !== false ) ) { $ cm = get_fast_modinfo ( $ eventobj -> courseid ) -> get_cm ( $ eventobj -> contextinstanceid ) ; $ modulelink = $ cm -> url ; $ template = str_replace ( '{modulelink}' , $ modulelink , $ template ) ; } $ template = str_replace ( '{rulename}' , $ subscription -> get_name ( $ context ) , $ template ) ; $ template = str_replace ( '{description}' , $ subscription -> get_description ( $ context ) , $ template ) ; $ template = str_replace ( '{eventname}' , $ subscription -> get_event_name ( ) , $ template ) ; return $ template ; }
docstring: Replace place holders in the template with respective content.
  
  @param string $template Message template.
  @param subscription $subscription subscription instance
  @param \stdclass $eventobj Event data
  @param \context $context context object
  
  @return mixed final template string.
docstring_tokens: Replace place holders in the template with respective content .