/**
  * Callback for the `the_posts` action, which loads the remaining experiment (if the currently requested page is under test) from the environment.
  *
  * @param array $posts The array of retrieved posts.
  *
  * @return array The array of retrieved posts.
  *
  * @since 4.0.0
  */
 public static function do_late_load($posts)
 {
     /** @var NelioABController $nelioab_controller */
     global $nelioab_controller;
     $current_id = $nelioab_controller->get_queried_post_id();
     // If I don't know which is the queried post, I can't complete the
     // environment yet.
     if (!$current_id) {
         return $posts;
     }
     if (!is_admin() && isset($_GET['nab'])) {
         /** @var int $val */
         $val = $_GET['nab'];
         /** @var NelioABPostAlternativeExperiment $exp */
         $exp = NULL;
         require_once NELIOAB_MODELS_DIR . '/experiments-manager.php';
         $running_exps = NelioABExperimentsManager::get_running_experiments_from_cache();
         for ($i = 0; $i < count($running_exps) && !$exp; ++$i) {
             $aux = $running_exps[$i];
             if ($aux instanceof NelioABAlternativeExperiment && $aux->get_originals_id() == $current_id) {
                 $exp = $aux;
             }
         }
         if ($exp) {
             NelioABVisitor::completeEnvironment($exp, $val);
         }
     }
     self::$is_fully_loaded = true;
     remove_action('the_posts', array('NelioABVisitor', 'do_late_load'));
     return $posts;
 }