original_string: public static function revert_to_draft($versionid) {
          $policyversion = new policy_version($versionid);
          if (!$policyversion->get('id') || !$policyversion->get('archived')) {
              throw new coding_exception('Version not found or is not archived');
          }
  
          $formdata = static::form_policydoc_data($policyversion);
          // Unarchived the new version.
          $formdata->archived = 0;
          return static::form_policydoc_update_new($formdata);
      }
code: public static function revert_to_draft($versionid) {
          $policyversion = new policy_version($versionid);
          if (!$policyversion->get('id') || !$policyversion->get('archived')) {
              throw new coding_exception('Version not found or is not archived');
          }
  
          $formdata = static::form_policydoc_data($policyversion);
          // Unarchived the new version.
          $formdata->archived = 0;
          return static::form_policydoc_update_new($formdata);
      }
code_tokens: public static function revert_to_draft ( $ versionid ) { $ policyversion = new policy_version ( $ versionid ) ; if ( ! $ policyversion -> get ( 'id' ) || ! $ policyversion -> get ( 'archived' ) ) { throw new coding_exception ( 'Version not found or is not archived' ) ; } $ formdata = static :: form_policydoc_data ( $ policyversion ) ; // Unarchived the new version. $ formdata -> archived = 0 ; return static :: form_policydoc_update_new ( $ formdata ) ; }
docstring: Create a new draft policy document from an archived version.
  
  @param int $versionid
  @return \tool_policy\policy_version persistent
docstring_tokens: Create a new draft policy document from an archived version .