示例#1
0
 /**
  * Exports a step in a JSON-encodable format.
  *
  * @param Step $step
  * @param bool $withSolutions
  *
  * @return array
  */
 public function exportStep(Step $step, $withSolutions = true)
 {
     $stepQuestions = $step->getStepQuestions();
     $items = [];
     /** @var StepQuestion $stepQuestion */
     foreach ($stepQuestions as $stepQuestion) {
         $question = $stepQuestion->getQuestion();
         $items[] = $this->questionManager->exportQuestion($question, $withSolutions);
     }
     return ['id' => $step->getId(), 'meta' => ['description' => $step->getText(), 'maxAttempts' => $step->getMaxAttempts(), 'title' => $step->getTitle()], 'items' => $items];
 }