name = $name; $this->isPaginated = $isPaginated; $this->entries = $entries; $this->cursor = $cursor; } /** * @param SearchResultEntry[] $entries * * @return static * * @since 20.0.0 */ public static function complete(string $name, array $entries): self { return new self( $name, false, $entries ); } /** * @param SearchResultEntry[] $entries * @param int|string $cursor * * @return static * * @since 20.0.0 */ public static function paginated(string $name, array $entries, $cursor): self { return new self( $name, true, $entries, $cursor ); } /** * @return array * * @since 20.0.0 */ public function jsonSerialize(): array { return [ 'name' => $this->name, 'isPaginated' => $this->isPaginated, 'entries' => array_values($this->entries), 'cursor' => $this->cursor, ]; } }