Code Duplication    Length = 9-9 lines in 2 locations

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

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