private function getWhitelistedVariation(Experiment $experiment, $userId)
    {
        // Check if user is whitelisted for a variation.
        $forcedVariations = $experiment->getForcedVariations();
        if (!is_null($forcedVariations) && isset($forcedVariations[$userId])) {
            $variationKey = $forcedVariations[$userId];
            $variation = $this->_projectConfig->getVariationFromKey($experiment->getKey(), $variationKey);
            if ($variationKey && !empty($variation->getKey())) {
                $this->_logger->log(
                    Logger::INFO,
                    sprintf('User "%s" is forced in variation "%s" of experiment "%s".', $userId, $variationKey, $experiment->getKey())
                );
            } else {
                return null;
            }
            return $variation;
        }
        return null;
    }
private function getWhitelistedVariation(Experiment $experiment, $userId)
    {
        // Check if user is whitelisted for a variation.
        $forcedVariations = $experiment->getForcedVariations();
        if (!is_null($forcedVariations) && isset($forcedVariations[$userId])) {
            $variationKey = $forcedVariations[$userId];
            $variation = $this->_projectConfig->getVariationFromKey($experiment->getKey(), $variationKey);
            if ($variationKey && !empty($variation->getKey())) {
                $this->_logger->log(
                    Logger::INFO,
                    sprintf('User "%s" is forced in variation "%s" of experiment "%s".', $userId, $variationKey, $experiment->getKey())
                );
            } else {
                return null;
            }
            return $variation;
        }
        return null;
    }
private function getWhitelistedVariation ( Experiment $ experiment , $ userId ) { // Check if user is whitelisted for a variation. $ forcedVariations = $ experiment -> getForcedVariations ( ) ; if ( ! is_null ( $ forcedVariations ) && isset ( $ forcedVariations [ $ userId ] ) ) { $ variationKey = $ forcedVariations [ $ userId ] ; $ variation = $ this -> _projectConfig -> getVariationFromKey ( $ experiment -> getKey ( ) , $ variationKey ) ; if ( $ variationKey && ! empty ( $ variation -> getKey ( ) ) ) { $ this -> _logger -> log ( Logger :: INFO , sprintf ( 'User "%s" is forced in variation "%s" of experiment "%s".' , $ userId , $ variationKey , $ experiment -> getKey ( ) ) ) ; } else { return null ; } return $ variation ; } return null ; }
Determine variation the user has been forced into.

@param $experiment Experiment Experiment in which user is to be bucketed.
@param $userId     string     string

@return null|Variation Representing the variation the user is forced into.
Determine variation the user has been forced into .