Code Duplication    Length = 9-9 lines in 2 locations

src/PlaygroundGame/Controller/Frontend/GameController.php 2 locations

@@ 297-305 (lines=9) @@
294
                // play position
295
                $keyplay = array_search('play', $viewSteps);
296
297
                if (!$keyplay) {
298
                    // play is not a substep, so it's a step
299
                    $keyplay = array_search('play', $steps);
300
                    $keyplayStep = true;
301
                } else {
302
                    // play is a substep so I search the index of its parent
303
                    $keyplay = array_search($keyplay, $steps);
304
                    $keyplayStep = false;
305
                }
306
307
                // If register step before play, I don't have no entry yet. I have to create one
308
                // If register after play step, I search for the last entry created by play step.
@@ 523-531 (lines=9) @@
520
        // play position
521
        $keyplay = array_search('play', $viewSteps);
522
523
        if (!$keyplay) {
524
            // play is not a substep, so it's a step
525
            $keyplay = array_search('play', $steps);
526
            $keyplayStep = true;
527
        } else {
528
            // play is a substep so I search the index of its parent
529
            $keyplay = array_search($keyplay, $steps);
530
            $keyplayStep = false;
531
        }
532
533
        if ($key && $keyplay && $keyplay <= $key) {
534
            // Has the user finished the game ?