Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 272-280 (lines=9) @@
269
                // play position
270
                $keyplay = array_search('play', $viewSteps);
271
272
                if (!$keyplay) {
273
                    // play is not a substep, so it's a step
274
                    $keyplay = array_search('play', $steps);
275
                    $keyplayStep = true;
276
                } else {
277
                    // play is a substep so I search the index of its parent
278
                    $keyplay = array_search($keyplay, $steps);
279
                    $keyplayStep = false;
280
                }
281
282
                // If register step before play, I don't have no entry yet. I have to create one
283
                // If register after play step, I search for the last entry created by play step.
@@ 498-506 (lines=9) @@
495
        // play position
496
        $keyplay = array_search('play', $viewSteps);
497
498
        if (!$keyplay) {
499
            // play is not a substep, so it's a step
500
            $keyplay = array_search('play', $steps);
501
            $keyplayStep = true;
502
        } else {
503
            // play is a substep so I search the index of its parent
504
            $keyplay = array_search($keyplay, $steps);
505
            $keyplayStep = false;
506
        }
507
508
        if ($key && $keyplay && $keyplay <= $key) {
509
            // Has the user finished the game ?