original_string: public function get_versions() {
          if ($this->versions === null) {
              $policyid = $this->get_policy_id_filter();
              $versionid = $this->get_version_id_filter();
              $this->versions = [];
              foreach ($this->get_avaliable_policies() as $policy) {
                  if ($policyid && $policy->id != $policyid) {
                      continue;
                  }
                  if ($versionid) {
                      if (array_key_exists($versionid, $policy->versions)) {
                          $this->versions[$versionid] = $policy->versions[$versionid];
                          break; // No need to keep searching.
                      }
                  } else if ($policy->currentversion) {
                      $this->versions[$policy->currentversion->id] = $policy->currentversion;
                  }
              }
          }
          return $this->versions;
      }
code: public function get_versions() {
          if ($this->versions === null) {
              $policyid = $this->get_policy_id_filter();
              $versionid = $this->get_version_id_filter();
              $this->versions = [];
              foreach ($this->get_avaliable_policies() as $policy) {
                  if ($policyid && $policy->id != $policyid) {
                      continue;
                  }
                  if ($versionid) {
                      if (array_key_exists($versionid, $policy->versions)) {
                          $this->versions[$versionid] = $policy->versions[$versionid];
                          break; // No need to keep searching.
                      }
                  } else if ($policy->currentversion) {
                      $this->versions[$policy->currentversion->id] = $policy->currentversion;
                  }
              }
          }
          return $this->versions;
      }
code_tokens: public function get_versions ( ) { if ( $ this -> versions === null ) { $ policyid = $ this -> get_policy_id_filter ( ) ; $ versionid = $ this -> get_version_id_filter ( ) ; $ this -> versions = [ ] ; foreach ( $ this -> get_avaliable_policies ( ) as $ policy ) { if ( $ policyid && $ policy -> id != $ policyid ) { continue ; } if ( $ versionid ) { if ( array_key_exists ( $ versionid , $ policy -> versions ) ) { $ this -> versions [ $ versionid ] = $ policy -> versions [ $ versionid ] ; break ; // No need to keep searching. } } else if ( $ policy -> currentversion ) { $ this -> versions [ $ policy -> currentversion -> id ] = $ policy -> currentversion ; } } } return $ this -> versions ; }
docstring: List of policies that match current filters
  
  @return array of versions to display indexed by versionid
docstring_tokens: List of policies that match current filters