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