File tree Expand file tree Collapse file tree 3 files changed +3
-45
lines changed
examples/php/php-step_strategy-02_replace_type_code_with_strategy/src Expand file tree Collapse file tree 3 files changed +3
-45
lines changed Original file line number Diff line number Diff line change @@ -15,20 +15,6 @@ public function code(): int
1515
1616 public function stepEstimatedCompletionMinutes (Step $ instance ): int
1717 {
18- $ estimation = 0 ;
19-
20- switch ($ instance ->type ->code ()) {
21- case StepType::VIDEO_STEP_TYPE :
22- $ estimation = $ instance ->videoDurationInMinutes ;
23- break ;
24- case StepType::QUIZ_STEP_TYPE :
25- $ estimation = QuizStepType::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ instance ->quizQuestions );
26- break ;
27- case StepType::EXERCISE_STEP_TYPE :
28- $ estimation = ExerciseStepType::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
29- break ;
30- }
31-
32- return $ estimation ;
18+ return self ::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
3319 }
3420}
Original file line number Diff line number Diff line change @@ -21,20 +21,6 @@ public function code(): int
2121
2222 public function stepEstimatedCompletionMinutes (Step $ instance ): int
2323 {
24- $ estimation = 0 ;
25-
26- switch ($ instance ->type ->code ()) {
27- case StepType::VIDEO_STEP_TYPE :
28- $ estimation = $ instance ->videoDurationInMinutes ;
29- break ;
30- case StepType::QUIZ_STEP_TYPE :
31- $ estimation = QuizStepType::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ instance ->quizQuestions );
32- break ;
33- case StepType::EXERCISE_STEP_TYPE :
34- $ estimation = ExerciseStepType::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
35- break ;
36- }
37-
38- return $ estimation ;
24+ return self ::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ instance ->quizQuestions );
3925 }
4026}
Original file line number Diff line number Diff line change @@ -20,20 +20,6 @@ public function code(): int
2020
2121 public function stepEstimatedCompletionMinutes (Step $ instance ): int
2222 {
23- $ estimation = 0 ;
24-
25- switch ($ instance ->type ->code ()) {
26- case StepType::VIDEO_STEP_TYPE :
27- $ estimation = $ instance ->videoDurationInMinutes ;
28- break ;
29- case StepType::QUIZ_STEP_TYPE :
30- $ estimation = QuizStepType::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ instance ->quizQuestions );
31- break ;
32- case StepType::EXERCISE_STEP_TYPE :
33- $ estimation = ExerciseStepType::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
34- break ;
35- }
36-
37- return $ estimation ;
23+ return $ instance ->videoDurationInMinutes ;
3824 }
3925}
You can’t perform that action at this time.
0 commit comments