original_string: protected function initial_steps_walker($step, $stats, $summarks, $positionstat = true, $dovariantalso = true) {
          $stats->s++;
          $stats->totalmarks += $step->mark;
          $stats->markarray[] = $step->mark;
  
          if ($positionstat) {
              $stats->totalothermarks += $summarks[$step->questionusageid] - $step->mark;
              $stats->othermarksarray[] = $summarks[$step->questionusageid] - $step->mark;
  
          } else {
              $stats->totalothermarks += $summarks[$step->questionusageid];
              $stats->othermarksarray[] = $summarks[$step->questionusageid];
          }
          if ($dovariantalso) {
              $this->initial_steps_walker($step, $stats->variantstats[$step->variant], $summarks, $positionstat, false);
          }
      }
code: protected function initial_steps_walker($step, $stats, $summarks, $positionstat = true, $dovariantalso = true) {
          $stats->s++;
          $stats->totalmarks += $step->mark;
          $stats->markarray[] = $step->mark;
  
          if ($positionstat) {
              $stats->totalothermarks += $summarks[$step->questionusageid] - $step->mark;
              $stats->othermarksarray[] = $summarks[$step->questionusageid] - $step->mark;
  
          } else {
              $stats->totalothermarks += $summarks[$step->questionusageid];
              $stats->othermarksarray[] = $summarks[$step->questionusageid];
          }
          if ($dovariantalso) {
              $this->initial_steps_walker($step, $stats->variantstats[$step->variant], $summarks, $positionstat, false);
          }
      }
code_tokens: protected function initial_steps_walker ( $ step , $ stats , $ summarks , $ positionstat = true , $ dovariantalso = true ) { $ stats -> s ++ ; $ stats -> totalmarks += $ step -> mark ; $ stats -> markarray [ ] = $ step -> mark ; if ( $ positionstat ) { $ stats -> totalothermarks += $ summarks [ $ step -> questionusageid ] - $ step -> mark ; $ stats -> othermarksarray [ ] = $ summarks [ $ step -> questionusageid ] - $ step -> mark ; } else { $ stats -> totalothermarks += $ summarks [ $ step -> questionusageid ] ; $ stats -> othermarksarray [ ] = $ summarks [ $ step -> questionusageid ] ; } if ( $ dovariantalso ) { $ this -> initial_steps_walker ( $ step , $ stats -> variantstats [ $ step -> variant ] , $ summarks , $ positionstat , false ) ; } }
docstring: Calculating the stats is a four step process.
  
  We loop through all 'last step' data first.
  
  Update $stats->totalmarks, $stats->markarray, $stats->totalothermarks
  and $stats->othermarksarray to include another state.
  
  @param object     $step         the state to add to the statistics.
  @param calculated $stats        the question statistics we are accumulating.
  @param array      $summarks     of the sum of marks for each question usage, indexed by question usage id
  @param bool       $positionstat whether this is a statistic of position of question.
  @param bool       $dovariantalso do we also want to do the same calculations for this variant?
docstring_tokens: Calculating the stats is a four step process .