index ?? null; if (isset($index)) { return "/$index/_rank_eval"; } return "/_rank_eval"; } public function getParamWhitelist(): array { return [ 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type' ]; } public function getMethod(): string { return isset($this->body) ? 'POST' : 'GET'; } public function setBody($body): RankEval { if (isset($body) !== true) { return $this; } $this->body = $body; return $this; } }