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

@@ 1543-1567 (lines=25) @@
1540
        return false;
1541
    }
1542
1543
    public static function cronMail()
1544
    {
1545
        $configuration = require 'config/application.config.php';
1546
        $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
1547
        $sm = new \Zend\ServiceManager\ServiceManager(new \Zend\Mvc\Service\ServiceManagerConfig($smConfig));
1548
        $sm->setService('ApplicationConfig', $configuration);
1549
        $sm->get('ModuleManager')->loadModules();
1550
        $sm->get('Application')->bootstrap();
1551
1552
        $mailService = $sm->get('playgrounduser_message');
1553
        $gameService = $sm->get('playgroundgame_quiz_service');
1554
1555
        $from = "[email protected]";
1556
        $subject = "sujet game";
1557
1558
        $to = "[email protected]";
1559
1560
        $game = $gameService->checkGame('qooqo');
1561
1562
        $message = $mailService->createTextMessage($from, $to, $subject, 'playground-game/email/share_reminder', array(
1563
            'game' => $game
1564
        ));
1565
1566
        $mailService->send($message);
1567
    }
1568
1569
    /**
1570
     * @param string $path