original_string: protected function get_completion_active_rule_descriptions($moduledata) {
          $activeruledescriptions = [];
  
          if ($moduledata->completion == COMPLETION_TRACKING_AUTOMATIC) {
              // Generate the description strings for the core conditional completion rules (if set).
              if (!empty($moduledata->completionview)) {
                  $activeruledescriptions[] = get_string('completionview_desc', 'completion');
              }
              if ($moduledata instanceof cm_info && !is_null($moduledata->completiongradeitemnumber) ||
                  ($moduledata instanceof stdClass && !empty($moduledata->completionusegrade))) {
                  $activeruledescriptions[] = get_string('completionusegrade_desc', 'completion');
              }
  
              // Now, ask the module to provide descriptions for its custom conditional completion rules.
              if ($customruledescriptions = component_callback($moduledata->modname,
                  'get_completion_active_rule_descriptions', [$moduledata])) {
                  $activeruledescriptions = array_merge($activeruledescriptions, $customruledescriptions);
              }
          }
  
          if ($moduledata->completion != COMPLETION_TRACKING_NONE) {
              if (!empty($moduledata->completionexpected)) {
                  $activeruledescriptions[] = get_string('completionexpecteddesc', 'completion',
                      userdate($moduledata->completionexpected));
              }
          }
  
          return $activeruledescriptions;
      }
code: protected function get_completion_active_rule_descriptions($moduledata) {
          $activeruledescriptions = [];
  
          if ($moduledata->completion == COMPLETION_TRACKING_AUTOMATIC) {
              // Generate the description strings for the core conditional completion rules (if set).
              if (!empty($moduledata->completionview)) {
                  $activeruledescriptions[] = get_string('completionview_desc', 'completion');
              }
              if ($moduledata instanceof cm_info && !is_null($moduledata->completiongradeitemnumber) ||
                  ($moduledata instanceof stdClass && !empty($moduledata->completionusegrade))) {
                  $activeruledescriptions[] = get_string('completionusegrade_desc', 'completion');
              }
  
              // Now, ask the module to provide descriptions for its custom conditional completion rules.
              if ($customruledescriptions = component_callback($moduledata->modname,
                  'get_completion_active_rule_descriptions', [$moduledata])) {
                  $activeruledescriptions = array_merge($activeruledescriptions, $customruledescriptions);
              }
          }
  
          if ($moduledata->completion != COMPLETION_TRACKING_NONE) {
              if (!empty($moduledata->completionexpected)) {
                  $activeruledescriptions[] = get_string('completionexpecteddesc', 'completion',
                      userdate($moduledata->completionexpected));
              }
          }
  
          return $activeruledescriptions;
      }
code_tokens: protected function get_completion_active_rule_descriptions ( $ moduledata ) { $ activeruledescriptions = [ ] ; if ( $ moduledata -> completion == COMPLETION_TRACKING_AUTOMATIC ) { // Generate the description strings for the core conditional completion rules (if set). if ( ! empty ( $ moduledata -> completionview ) ) { $ activeruledescriptions [ ] = get_string ( 'completionview_desc' , 'completion' ) ; } if ( $ moduledata instanceof cm_info && ! is_null ( $ moduledata -> completiongradeitemnumber ) || ( $ moduledata instanceof stdClass && ! empty ( $ moduledata -> completionusegrade ) ) ) { $ activeruledescriptions [ ] = get_string ( 'completionusegrade_desc' , 'completion' ) ; } // Now, ask the module to provide descriptions for its custom conditional completion rules. if ( $ customruledescriptions = component_callback ( $ moduledata -> modname , 'get_completion_active_rule_descriptions' , [ $ moduledata ] ) ) { $ activeruledescriptions = array_merge ( $ activeruledescriptions , $ customruledescriptions ) ; } } if ( $ moduledata -> completion != COMPLETION_TRACKING_NONE ) { if ( ! empty ( $ moduledata -> completionexpected ) ) { $ activeruledescriptions [ ] = get_string ( 'completionexpecteddesc' , 'completion' , userdate ( $ moduledata -> completionexpected ) ) ; } } return $ activeruledescriptions ; }
docstring: Get the descriptions for all active conditional completion rules for the current module.
  
  @param cm_info|stdClass $moduledata either instance of cm_info (with 'customcompletionrules' in customdata) or
  object with fields ->completion, ->completionview, ->completionexpected, ->completionusegrade
  and ->customdata['customcompletionrules']
  @return array $activeruledescriptions an array of strings describing the active completion rules.
docstring_tokens: Get the descriptions for all active conditional completion rules for the current module .