index ?? null; if (isset($index)) { return "/$index/_count"; } return "/_count"; } public function getParamWhitelist(): array { return [ 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after' ]; } public function getMethod(): string { return isset($this->body) ? 'POST' : 'GET'; } public function setBody($body): Count { if (isset($body) !== true) { return $this; } $this->body = $body; return $this; } }