Code Duplication    Length = 11-16 lines in 3 locations

src/PlaygroundGame/Mapper/Entry.php 3 locations

@@ 69-79 (lines=11) @@
66
     * @param unknown_type $game
67
     * @param unknown_type $user
68
     */
69
    public function findLastEntriesByUser($game, $user, $dateLimit)
70
    {
71
        $query = $this->em->createQuery(
72
            'SELECT COUNT(e.id) FROM PlaygroundGame\Entity\Entry e 
73
             WHERE e.user = :user AND e.game = :game AND (e.bonus = 0 OR e.bonus IS NULL) AND e.created_at >= :date'
74
        );
75
        $query->setParameter('user', $user);
76
        $query->setParameter('game', $game);
77
        $query->setParameter('date', $dateLimit);
78
79
        $total = $query->getSingleScalarResult();
80
81
        return $total;
82
    }
@@ 84-95 (lines=12) @@
81
        return $total;
82
    }
83
    
84
    public function findLastEntriesByAnonymousIdentifier($game, $anonymousIdentifier, $dateLimit)
85
    {
86
    
87
        $query = $this->em->createQuery(
88
            'SELECT COUNT(e.id) FROM PlaygroundGame\Entity\Entry e 
89
             WHERE e.anonymousIdentifier = :anonymousIdentifier AND e.game = :game 
90
             AND (e.bonus = 0 OR e.bonus IS NULL) AND e.created_at >= :date'
91
        );
92
        $query->setParameter('anonymousIdentifier', $anonymousIdentifier);
93
        $query->setParameter('game', $game);
94
        $query->setParameter('date', $dateLimit);
95
    
96
        $total = $query->getSingleScalarResult();
97
98
        return $total;
@@ 137-152 (lines=16) @@
134
        return $dateLimit;
135
    }
136
137
    public function findLastEntriesByIp($game, $ip, $limitScale)
138
    {
139
        $dateLimit = $this->getDateLimit($limitScale);
140
    
141
        $query = $this->em->createQuery(
142
            'SELECT COUNT(e.id) FROM PlaygroundGame\Entity\Entry e 
143
             WHERE e.ip = :ip AND e.game = :game AND (e.bonus = 0 OR e.bonus IS NULL) AND e.created_at >= :date'
144
        );
145
        $query->setParameter('ip', $ip);
146
        $query->setParameter('game', $game);
147
        $query->setParameter('date', $dateLimit);
148
    
149
        $total = $query->getSingleScalarResult();
150
    
151
        return $total;
152
    }
153
154
    /**
155
     * get users with only one participation able to