|
24 | 24 | use Optimizely\DecisionService\DecisionService; |
25 | 25 | use Optimizely\DecisionService\FeatureDecision; |
26 | 26 | use Optimizely\Entity\Experiment; |
27 | | -use Optimizely\Entity\FeatureFlag; |
28 | 27 | use Optimizely\Entity\FeatureVariable; |
29 | | -use Optimizely\Entity\Rollout; |
30 | 28 | use Optimizely\Logger\DefaultLogger; |
31 | 29 | use Optimizely\ErrorHandler\ErrorHandlerInterface; |
32 | 30 | use Optimizely\ErrorHandler\NoOpErrorHandler; |
|
38 | 36 | use Optimizely\Notification\NotificationCenter; |
39 | 37 | use Optimizely\Notification\NotificationType; |
40 | 38 | use Optimizely\UserProfile\UserProfileServiceInterface; |
41 | | -use Optimizely\Utils\EventTagUtils; |
42 | 39 | use Optimizely\Utils\Validator; |
43 | 40 | use Optimizely\Utils\VariableTypeUtils; |
44 | 41 |
|
@@ -502,20 +499,19 @@ public function isFeatureEnabled($featureFlagKey, $userId, $attributes = null) |
502 | 499 | $experiment = $decision->getExperiment(); |
503 | 500 | $variation = $decision->getVariation(); |
504 | 501 |
|
505 | | - if (is_null($variation) || !$variation->getFeatureEnabled()) { |
506 | | - $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is not enabled for user '{$userId}'."); |
507 | | - return false; |
508 | | - } |
509 | | - |
510 | 502 | if ($decision->getSource() == FeatureDecision::DECISION_SOURCE_EXPERIMENT) { |
511 | 503 | $this->sendImpressionEvent($experiment->getKey(), $variation->getKey(), $userId, $attributes); |
512 | 504 | } else { |
513 | 505 | $this->_logger->log(Logger::INFO, "The user '{$userId}' is not being experimented on Feature Flag '{$featureFlagKey}'."); |
514 | 506 | } |
515 | 507 |
|
516 | | - $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is enabled for user '{$userId}'."); |
| 508 | + if ($variation->getFeatureEnabled()) { |
| 509 | + $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is enabled for user '{$userId}'."); |
| 510 | + return true; |
| 511 | + } |
517 | 512 |
|
518 | | - return true; |
| 513 | + $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is not enabled for user '{$userId}'."); |
| 514 | + return false; |
519 | 515 | } |
520 | 516 |
|
521 | 517 | /** |
|
0 commit comments