File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -59,19 +59,14 @@ public function serialize(UserState $state)
5959 {
6060 $ saveFile = sprintf ('%s/%s ' , $ this ->path , static ::SAVE_FILE );
6161
62- if (!file_exists ($ saveFile )) {
63- $ data = [];
64- $ data [$ this ->workshopName ] = [
65- 'completed_exercises ' => $ state ->getCompletedExercises (),
66- 'current_exercise ' => $ state ->getCurrentExercise (),
67- ];
68- } else {
69- $ data = $ this ->readJson ($ saveFile );
70- $ data [$ this ->workshopName ] = [
71- 'completed_exercises ' => $ state ->getCompletedExercises (),
72- 'current_exercise ' => $ state ->getCurrentExercise (),
73- ];
74- }
62+ $ data = file_exists ($ saveFile )
63+ ? $ this ->readJson ($ saveFile )
64+ : [];
65+
66+ $ data [$ this ->workshopName ] = [
67+ 'completed_exercises ' => $ state ->getCompletedExercises (),
68+ 'current_exercise ' => $ state ->getCurrentExercise (),
69+ ];
7570
7671 return file_put_contents ($ saveFile , json_encode ($ data ));
7772 }
You can’t perform that action at this time.
0 commit comments