feat: sort by id desc#8
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR modifies the sorting behavior to use BSI-ID in descending order instead of date sorting to maintain consistent list ordering. The change updates the URL parameter to sort by title and adds explicit sorting by key in the code.
- Changes the BSI website URL parameter from sorting by
dateOfRevision_dttotitle_text_sortin descending order - Adds explicit key-based reverse sorting using
krsort()with natural sorting - Includes a test to verify the retrieved keys are properly sorted in descending order
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Retrieve.php | Updates URL sorting parameter and adds krsort() to ensure descending key order |
| tests/RetrieveTest.php | Adds test case to verify retrieved keys are in descending order |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| /** @noinspection JsonEncodingApiUsageInspection */ | ||
| expect($keys)->toBe($sorted) | ||
| ->and(count($keys))->toBe(count($sorted)) | ||
| ->and(array_values($keys))->toBe(array_values($sorted)) |
There was a problem hiding this comment.
This assertion is redundant since both $keys and $sorted are arrays of keys (not associative arrays). The array_values() call is unnecessary and the assertion duplicates the main comparison on line 62.
| ->and(array_values($keys))->toBe(array_values($sorted)) |
Sort by BSI-ID instead of date, to keep the list sorting consistent.