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;
    }