Пример #1
0
 /**
  * Adds a non-global, non-headline Alternative Experiment in self::$exps.
  *
  * @param NelioABPostAlternativeExperiment $exp The Alternative Experiment to be added.
  * @param int $alt_index The index of the alternative that this visitor is supposed to see.
  *            If 0, the original version is added; if 1, the first
  *            alternative; if 2, the second; and so on.
  *
  * @since 4.0.0
  */
 private static function add_regular_exp($exp, $alt_index)
 {
     $alt = $exp->get_originals_id();
     if ($alt_index > 0) {
         --$alt_index;
         $alts = $exp->get_alternatives();
         if ($alt_index < count($alts)) {
             /** @var NelioABAlternative $aux */
             $aux = $alts[$alt_index];
             $alt = $aux->get_value();
         }
     }
     if ($alt) {
         self::$exps[$exp->get_originals_id()] = $alt;
     }
 }