Code Duplication    Length = 25-26 lines in 2 locations

src/PlaygroundGame/Service/Cron.php 1 location

@@ 33-58 (lines=26) @@
30
     */
31
    protected $options;
32
33
    public static function cronMail()
34
    {
35
        $configuration = require 'config/application.config.php';
36
        $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
37
        $sm = new \Zend\ServiceManager\ServiceManager(new \Zend\Mvc\Service\ServiceManagerConfig($smConfig));
38
        $sm->setService('ApplicationConfig', $configuration);
39
        $sm->get('ModuleManager')->loadModules();
40
        $sm->get('Application')->bootstrap();
41
42
        $mailService = $sm->get('playgrounduser_message');
43
        $gameService = $sm->get('playgroundgame_quiz_service');
44
45
        $from    = "[email protected]";
46
        $subject = "sujet game";
47
48
        $to = "[email protected]";
49
50
        $game = $gameService->checkGame('qooqo');
51
52
        // On recherche les joueurs qui n'ont pas partagé leur qquiz après avoir joué
53
        // entry join user join game : distinct user et game et game_entry = 0 et updated_at <= jour-1 et > jour - 2
54
55
        $message = $mailService->createTextMessage(
56
            $from,
57
            $to,
58
            $subject,
59
            'playground-game/email/share_reminder',
60
            array('game' => $game)
61
        );

src/PlaygroundGame/Service/Game.php 1 location

@@ 1518-1542 (lines=25) @@
1515
        return false;
1516
    }
1517
1518
    public static function cronMail()
1519
    {
1520
        $configuration = require 'config/application.config.php';
1521
        $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
1522
        $sm = new \Zend\ServiceManager\ServiceManager(new \Zend\Mvc\Service\ServiceManagerConfig($smConfig));
1523
        $sm->setService('ApplicationConfig', $configuration);
1524
        $sm->get('ModuleManager')->loadModules();
1525
        $sm->get('Application')->bootstrap();
1526
1527
        $mailService = $sm->get('playgrounduser_message');
1528
        $gameService = $sm->get('playgroundgame_quiz_service');
1529
1530
        $from = "[email protected]";
1531
        $subject = "sujet game";
1532
1533
        $to = "[email protected]";
1534
1535
        $game = $gameService->checkGame('qooqo');
1536
1537
        $message = $mailService->createTextMessage($from, $to, $subject, 'playground-game/email/share_reminder', array(
1538
            'game' => $game
1539
        ));
1540
1541
        $mailService->send($message);
1542
    }
1543
1544
    /**
1545
     * @param string $path