public function getForcedVariation($experimentKey, $userId)
    {

        if (!isset($this->_forcedVariationMap[$userId])) {
            $this->_logger->log(Logger::DEBUG, sprintf('User "%s" is not in the forced variation map.', $userId));
            return null;
        }

        $experimentToVariationMap = $this->_forcedVariationMap[$userId];
        $experimentId = $this->getExperimentFromKey($experimentKey)->getId();
        // check for null and empty string experiment ID
        if (strlen($experimentId) == 0) {
            // this case is logged in getExperimentFromKey
            return null;
        }

        if (!isset($experimentToVariationMap[$experimentId])) {
            $this->_logger->log(Logger::DEBUG, sprintf('No experiment "%s" mapped to user "%s" in the forced variation map.', $experimentKey, $userId));
            return null;
        }

        $variationId = $experimentToVariationMap[$experimentId];
        $variation = $this->getVariationFromId($experimentKey, $variationId);
        $variationKey = $variation->getKey();

        $this->_logger->log(Logger::DEBUG, sprintf('Variation "%s" is mapped to experiment "%s" and user "%s" in the forced variation map', $variationKey, $experimentKey, $userId));

        return $variation;
    }
public function getForcedVariation($experimentKey, $userId)
    {

        if (!isset($this->_forcedVariationMap[$userId])) {
            $this->_logger->log(Logger::DEBUG, sprintf('User "%s" is not in the forced variation map.', $userId));
            return null;
        }

        $experimentToVariationMap = $this->_forcedVariationMap[$userId];
        $experimentId = $this->getExperimentFromKey($experimentKey)->getId();
        // check for null and empty string experiment ID
        if (strlen($experimentId) == 0) {
            // this case is logged in getExperimentFromKey
            return null;
        }

        if (!isset($experimentToVariationMap[$experimentId])) {
            $this->_logger->log(Logger::DEBUG, sprintf('No experiment "%s" mapped to user "%s" in the forced variation map.', $experimentKey, $userId));
            return null;
        }

        $variationId = $experimentToVariationMap[$experimentId];
        $variation = $this->getVariationFromId($experimentKey, $variationId);
        $variationKey = $variation->getKey();

        $this->_logger->log(Logger::DEBUG, sprintf('Variation "%s" is mapped to experiment "%s" and user "%s" in the forced variation map', $variationKey, $experimentKey, $userId));

        return $variation;
    }
public function getForcedVariation ( $ experimentKey , $ userId ) { if ( ! isset ( $ this -> _forcedVariationMap [ $ userId ] ) ) { $ this -> _logger -> log ( Logger :: DEBUG , sprintf ( 'User "%s" is not in the forced variation map.' , $ userId ) ) ; return null ; } $ experimentToVariationMap = $ this -> _forcedVariationMap [ $ userId ] ; $ experimentId = $ this -> getExperimentFromKey ( $ experimentKey ) -> getId ( ) ; // check for null and empty string experiment ID if ( strlen ( $ experimentId ) == 0 ) { // this case is logged in getExperimentFromKey return null ; } if ( ! isset ( $ experimentToVariationMap [ $ experimentId ] ) ) { $ this -> _logger -> log ( Logger :: DEBUG , sprintf ( 'No experiment "%s" mapped to user "%s" in the forced variation map.' , $ experimentKey , $ userId ) ) ; return null ; } $ variationId = $ experimentToVariationMap [ $ experimentId ] ; $ variation = $ this -> getVariationFromId ( $ experimentKey , $ variationId ) ; $ variationKey = $ variation -> getKey ( ) ; $ this -> _logger -> log ( Logger :: DEBUG , sprintf ( 'Variation "%s" is mapped to experiment "%s" and user "%s" in the forced variation map' , $ variationKey , $ experimentKey , $ userId ) ) ; return $ variation ; }
Gets the forced variation key for the given user and experiment.

@param $experimentKey string Key for experiment.
@param $userId string The user Id.

@return Variation The variation which the given user and experiment should be forced into.
Gets the forced variation key for the given user and experiment .