Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 306-314 (lines=9) @@
303
                // play position
304
                $keyplay = array_search('play', $viewSteps);
305
306
                if (!$keyplay) {
307
                    // play is not a substep, so it's a step
308
                    $keyplay = array_search('play', $steps);
309
                    $keyplayStep = true;
310
                } else {
311
                    // play is a substep so I search the index of its parent
312
                    $keyplay = array_search($keyplay, $steps);
313
                    $keyplayStep = false;
314
                }
315
316
                // If register step before play, I don't have no entry yet. I have to create one
317
                // If register after play step, I search for the last entry created by play step.
@@ 532-540 (lines=9) @@
529
        // play position
530
        $keyplay = array_search('play', $viewSteps);
531
532
        if (!$keyplay) {
533
            // play is not a substep, so it's a step
534
            $keyplay = array_search('play', $steps);
535
            $keyplayStep = true;
536
        } else {
537
            // play is a substep so I search the index of its parent
538
            $keyplay = array_search($keyplay, $steps);
539
            $keyplayStep = false;
540
        }
541
542
        if ($key && $keyplay && $keyplay <= $key) {
543
            // Has the user finished the game ?