-
Notifications
You must be signed in to change notification settings - Fork 29
feat(ForcedDecisions): add forced-decisions APIs to OptimizelyUserContext #233
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
Conversation
isFeatureEnabled
getFeatureVariable{Type}
getAllFeatureVariables
getEnabledFeatures
jaeopt
left a comment
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.
All changes look good! A couple of more changes suggested.
…ations are getting removed
jaeopt
left a comment
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.
LGTM
| $flagRules = $this->getAllRulesForFlag($flag); | ||
|
|
||
| foreach ($flagRules as $rule) { | ||
| $flagVariations = array_merge($flagVariations, array_filter(array_values($rule->getVariations()), function ($variation) use ($flagVariations) { |
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.
My understanding of closures in PHP suggests this is copying the value of $flagVariations and not referencing it. Not sure if this could provide an edge case where the $flagVariations array is modified outside of this set of functions.
src/Optimizely/Optimizely.php
Outdated
| if (!$this->getConfig()) { | ||
| $this->_logger->log( | ||
| Logger::ERROR, | ||
| "Optimizely SDK not configured properly yet." |
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.
Is there a static message for this that can be referenced?
dustin-sier
left a comment
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.
Have a few questions, once that's done LGTM
| public function findForcedDecision($context) | ||
| { | ||
| $foundVariationKey = null; | ||
| if (!$this->forcedDecisions) { |
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.
Any reason to do this vs. isset?
dustin-sier
left a comment
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.
Looks good!
Summary
Add a set of new APIs for forced-decisions to OptimizelyUserContext:
Test plan