$rows Rows fetched with $limit + 1. * @return array{items: list, next_cursor: ?string} */ public static function page(array $rows, int $limit, int $offset): array { return [ 'items' => array_slice($rows, 0, $limit), 'next_cursor' => count($rows) > $limit ? self::encode($offset + $limit) : null, ]; } public static function invalid(): WP_Error { return Errors::invalidInput( 'Ungültiger cursor.', ['cursor' => 'unbekanntes Format'], 'cursor unverändert aus next_cursor der letzten Antwort übernehmen oder weglassen.' ); } /** @return array> */ public static function inputProperties(): array { return [ 'limit' => [ 'type' => 'integer', 'minimum' => 1, 'maximum' => self::MAX_LIMIT, 'description' => 'Einträge pro Seite (Standard 20).', ], 'cursor' => [ 'type' => 'string', 'description' => 'next_cursor der vorherigen Antwort, um weiterzublättern.', ], ]; } }