public function getVariationForFeature(FeatureFlag $featureFlag, $userId, $userAttributes)
    {
        //Evaluate in this order:
        //1. Attempt to bucket user into experiment using feature flag.
        //2. Attempt to bucket user into rollout using the feature flag.

        // Check if the feature flag is under an experiment and the the user is bucketed into one of these experiments
        $decision = $this->getVariationForFeatureExperiment($featureFlag, $userId, $userAttributes);
        if ($decision) {
            return $decision;
        }

        // Check if the feature flag has rollout and the user is bucketed into one of it's rules
        $decision = $this->getVariationForFeatureRollout($featureFlag, $userId, $userAttributes);
        if ($decision) {
            $this->_logger->log(
                Logger::INFO,
                "User '{$userId}' is bucketed into rollout for feature flag '{$featureFlag->getKey()}'."
            );

            return $decision;
        }

        $this->_logger->log(
            Logger::INFO,
            "User '{$userId}' is not bucketed into rollout for feature flag '{$featureFlag->getKey()}'."
        );

        return new FeatureDecision(null, null, FeatureDecision::DECISION_SOURCE_ROLLOUT);
    }
public function getVariationForFeature(FeatureFlag $featureFlag, $userId, $userAttributes)
    {
        //Evaluate in this order:
        //1. Attempt to bucket user into experiment using feature flag.
        //2. Attempt to bucket user into rollout using the feature flag.

        // Check if the feature flag is under an experiment and the the user is bucketed into one of these experiments
        $decision = $this->getVariationForFeatureExperiment($featureFlag, $userId, $userAttributes);
        if ($decision) {
            return $decision;
        }

        // Check if the feature flag has rollout and the user is bucketed into one of it's rules
        $decision = $this->getVariationForFeatureRollout($featureFlag, $userId, $userAttributes);
        if ($decision) {
            $this->_logger->log(
                Logger::INFO,
                "User '{$userId}' is bucketed into rollout for feature flag '{$featureFlag->getKey()}'."
            );

            return $decision;
        }

        $this->_logger->log(
            Logger::INFO,
            "User '{$userId}' is not bucketed into rollout for feature flag '{$featureFlag->getKey()}'."
        );

        return new FeatureDecision(null, null, FeatureDecision::DECISION_SOURCE_ROLLOUT);
    }
public function getVariationForFeature ( FeatureFlag $ featureFlag , $ userId , $ userAttributes ) { //Evaluate in this order: //1. Attempt to bucket user into experiment using feature flag. //2. Attempt to bucket user into rollout using the feature flag. // Check if the feature flag is under an experiment and the the user is bucketed into one of these experiments $ decision = $ this -> getVariationForFeatureExperiment ( $ featureFlag , $ userId , $ userAttributes ) ; if ( $ decision ) { return $ decision ; } // Check if the feature flag has rollout and the user is bucketed into one of it's rules $ decision = $ this -> getVariationForFeatureRollout ( $ featureFlag , $ userId , $ userAttributes ) ; if ( $ decision ) { $ this -> _logger -> log ( Logger :: INFO , "User '{$userId}' is bucketed into rollout for feature flag '{$featureFlag->getKey()}'." ) ; return $ decision ; } $ this -> _logger -> log ( Logger :: INFO , "User '{$userId}' is not bucketed into rollout for feature flag '{$featureFlag->getKey()}'." ) ; return new FeatureDecision ( null , null , FeatureDecision :: DECISION_SOURCE_ROLLOUT ) ; }
Get the variation the user is bucketed into for the given FeatureFlag

@param  FeatureFlag $featureFlag    The feature flag the user wants to access
@param  string      $userId         user ID
@param  array       $userAttributes user attributes
@return Decision  if getVariationForFeatureExperiment or getVariationForFeatureRollout returns a Decision
null      otherwise
Get the variation the user is bucketed into for the given FeatureFlag