File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
examples/php/php-step_strategy-02_replace_type_code_with_strategy/src Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,16 @@ public function estimatedCompletionMinutes(): int
3030 {
3131 $ estimation = 0 ;
3232
33- if ($ this ->type === self ::VIDEO_STEP_TYPE ) {
34- $ estimation = $ this ->videoDurationInMinutes ;
35- } elseif ($ this ->type === self ::QUIZ_STEP_TYPE ) {
36- $ estimation = self ::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ this ->quizQuestions );
37- } elseif ($ this ->type === self ::EXERCISE_STEP_TYPE ) {
38- $ estimation = self ::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
33+ switch ($ this ->type ) {
34+ case self ::VIDEO_STEP_TYPE :
35+ $ estimation = $ this ->videoDurationInMinutes ;
36+ break ;
37+ case self ::QUIZ_STEP_TYPE :
38+ $ estimation = self ::QUIZ_STEP_QUESTION_DURATION_ESTIMATION_IN_MINUTES * count ($ this ->quizQuestions );
39+ break ;
40+ case self ::EXERCISE_STEP_TYPE :
41+ $ estimation = self ::EXERCISE_STEP_DURATION_ESTIMATION_IN_MINUTES ;
42+ break ;
3943 }
4044
4145 return $ estimation ;
You can’t perform that action at this time.
0 commit comments