Code Duplication    Length = 9-9 lines in 2 locations

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

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