original_string: protected function set_rules($record) {
          $comp = $record->createdcomp;
          if ($record->ruletype) {
              $class = $record->ruletype;
              if (class_exists($class)) {
                  $oldruleconfig = $record->ruleconfig;
                  if ($oldruleconfig == "null") {
                      $oldruleconfig = null;
                  }
                  $newruleconfig = $class::migrate_config($oldruleconfig, $this->mappings);
                  $comp->set('ruleconfig', $newruleconfig);
                  $comp->set('ruletype', $class);
                  $comp->set('ruleoutcome', $record->ruleoutcome);
                  $comp->update();
              }
          }
          foreach ($record->children as $child) {
              $this->set_rules($child);
          }
      }
code: protected function set_rules($record) {
          $comp = $record->createdcomp;
          if ($record->ruletype) {
              $class = $record->ruletype;
              if (class_exists($class)) {
                  $oldruleconfig = $record->ruleconfig;
                  if ($oldruleconfig == "null") {
                      $oldruleconfig = null;
                  }
                  $newruleconfig = $class::migrate_config($oldruleconfig, $this->mappings);
                  $comp->set('ruleconfig', $newruleconfig);
                  $comp->set('ruletype', $class);
                  $comp->set('ruleoutcome', $record->ruleoutcome);
                  $comp->update();
              }
          }
          foreach ($record->children as $child) {
              $this->set_rules($child);
          }
      }
code_tokens: protected function set_rules ( $ record ) { $ comp = $ record -> createdcomp ; if ( $ record -> ruletype ) { $ class = $ record -> ruletype ; if ( class_exists ( $ class ) ) { $ oldruleconfig = $ record -> ruleconfig ; if ( $ oldruleconfig == "null" ) { $ oldruleconfig = null ; } $ newruleconfig = $ class :: migrate_config ( $ oldruleconfig , $ this -> mappings ) ; $ comp -> set ( 'ruleconfig' , $ newruleconfig ) ; $ comp -> set ( 'ruletype' , $ class ) ; $ comp -> set ( 'ruleoutcome' , $ record -> ruleoutcome ) ; $ comp -> update ( ) ; } } foreach ( $ record -> children as $ child ) { $ this -> set_rules ( $ child ) ; } }
docstring: Create any completion rule attached to this competency.
  @param stdClass $record
docstring_tokens: Create any completion rule attached to this competency .