-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add assignment and exposure event tracking options #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
📝 Documentation updates detected! New suggestion: Document FetchOptions for PHP Experiment SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the RemoteEvaluationClient to support additional fetch options for tracking assignments and exposures. The changes introduce a new FetchOptions class that encapsulates flag keys and tracking preferences, making the API more flexible and extensible.
- Adds
tracksAssignmentandtracksExposurefields toFetchOptionsfor controlling tracking behavior - Refactors the
fetchmethod to accept either an array of flag keys, aFetchOptionsobject, or null - Implements HTTP header handling (
X-Amp-Exp-TrackandX-Amp-Exp-Exposure-Track) based on tracking options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Remote/FetchOptions.php | Added tracksAssignment and tracksExposure properties with nullable bool types and default values |
| src/Remote/RemoteEvaluationClient.php | Refactored fetch method to accept multiple argument types and extracted core logic to fetchWithOptions private method |
| tests/Remote/RemoteEvaluationClientTest.php | Added comprehensive test coverage for various FetchOptions scenarios including tracking headers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ($arg !== null && is_array($arg)) { | ||
| return $this->fetchWithOptions($user, new FetchOptions($arg, null, null)); | ||
| } | ||
| if ($arg !== null && is_object($arg) && $arg instanceof FetchOptions) { |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check is_object($arg) is redundant when followed by $arg instanceof FetchOptions. The instanceof operator already returns false for non-objects. Simplify line 131 to just if ($arg !== null && $arg instanceof FetchOptions).
| if ($arg !== null && is_object($arg) && $arg instanceof FetchOptions) { | |
| if ($arg !== null && $arg instanceof FetchOptions) { |
Adds track, or not to track, assignment and exposure events options to fetch requests.