original_string: protected function prepare_policy($policyid, $versionid) {
  
          if ($versionid) {
              $this->policy = api::get_policy_version($versionid);
  
          } else {
              $this->policy = array_reduce(api::list_current_versions(), function ($carry, $current) use ($policyid) {
                  if ($current->policyid == $policyid) {
                      return $current;
                  }
                  return $carry;
              });
          }
  
          if (empty($this->policy)) {
              throw new \moodle_exception('errorpolicyversionnotfound', 'tool_policy');
          }
      }
code: protected function prepare_policy($policyid, $versionid) {
  
          if ($versionid) {
              $this->policy = api::get_policy_version($versionid);
  
          } else {
              $this->policy = array_reduce(api::list_current_versions(), function ($carry, $current) use ($policyid) {
                  if ($current->policyid == $policyid) {
                      return $current;
                  }
                  return $carry;
              });
          }
  
          if (empty($this->policy)) {
              throw new \moodle_exception('errorpolicyversionnotfound', 'tool_policy');
          }
      }
code_tokens: protected function prepare_policy ( $ policyid , $ versionid ) { if ( $ versionid ) { $ this -> policy = api :: get_policy_version ( $ versionid ) ; } else { $ this -> policy = array_reduce ( api :: list_current_versions ( ) , function ( $ carry , $ current ) use ( $ policyid ) { if ( $ current -> policyid == $ policyid ) { return $ current ; } return $ carry ; } ) ; } if ( empty ( $ this -> policy ) ) { throw new \ moodle_exception ( 'errorpolicyversionnotfound' , 'tool_policy' ) ; } }
docstring: Loads the policy version to display on the page.
  
  @param int $policyid The policy id for this page.
  @param int $versionid The version id to show. Empty tries to load the current one.
docstring_tokens: Loads the policy version to display on the page .