/**
  * Save the students state for this workshop to disk.
  *
  * @param UserState $state
  * @return int
  */
 public function serialize(UserState $state)
 {
     $saveFile = sprintf('%s/%s', $this->path, static::SAVE_FILE);
     $data = file_exists($saveFile) ? $this->readJson($saveFile) : [];
     $data[$this->workshopName] = ['completed_exercises' => $state->getCompletedExercises(), 'current_exercise' => $state->getCurrentExercise()];
     return file_put_contents($saveFile, json_encode($data));
 }
 /**
  * @param UserState $state
  *
  * @return int
  */
 public function serialize(UserState $state)
 {
     return file_put_contents($this->path, json_encode(['completed_exercises' => $state->getCompletedExercises(), 'current_exercise' => $state->getCurrentExercise()]));
 }