Code Duplication    Length = 15-16 lines in 3 locations

Entity/Repositories/MailgunEventRepository.php 3 locations

@@ 79-93 (lines=15) @@
76
        return $qb;
77
    }
78
79
    public function getEventTypes()
80
    {
81
        $q = $this->getEntityManager()->createQueryBuilder()
82
            ->select("e.event as event")
83
            ->from($this->getEntityName(), "e")
84
            ->distinct()
85
            ->orderBy('e.event ', 'asc')
86
            ->getQuery();
87
        $result = array();
88
        foreach ($q->execute() as $next) {
89
            $result[] = $next['event'];
90
        }
91
92
        return $result;
93
    }
94
95
    public function getDomains()
96
    {
@@ 95-110 (lines=16) @@
92
        return $result;
93
    }
94
95
    public function getDomains()
96
    {
97
        $q = $this->getEntityManager()->createQueryBuilder()
98
            ->select("e.domain as domain")
99
            ->from($this->getEntityName(), "e")
100
            ->distinct()
101
            ->orderBy('e.domain ', 'asc')
102
            ->getQuery();
103
104
        $result = array();
105
        foreach ($q->execute() as $next) {
106
            $result[] = $next['domain'];
107
        }
108
109
        return $result;
110
    }
111
112
    public function getRecipients()
113
    {
@@ 112-127 (lines=16) @@
109
        return $result;
110
    }
111
112
    public function getRecipients()
113
    {
114
        $q = $this->getEntityManager()->createQueryBuilder()
115
            ->select("e.recipient as recipient")
116
            ->from($this->getEntityName(), "e")
117
            ->distinct()
118
            ->orderBy('e.recipient ', 'asc')
119
            ->getQuery();
120
121
        $result = array();
122
        foreach ($q->execute() as $next) {
123
            $result[] = $next['recipient'];
124
        }
125
126
        return $result;
127
    }
128
129
    /**
130
     * Get last known sender IP based on stored events list