Code Duplication    Length = 15-16 lines in 3 locations

Entity/Repositories/MailgunEventRepository.php 3 locations

@@ 95-109 (lines=15) @@
92
     *
93
     * @return array of string
94
     */
95
    public function getEventTypes()
96
    {
97
        $q = $this->getEntityManager()->createQueryBuilder()
98
            ->select('e.event as event')
99
            ->from($this->getEntityName(), 'e')
100
            ->distinct()
101
            ->orderBy('e.event ', 'asc')
102
            ->getQuery();
103
        $result = array();
104
        foreach ($q->execute() as $next) {
105
            $result[] = $next['event'];
106
        }
107
108
        return $result;
109
    }
110
111
    /**
112
     * Get distinct list of email domains.
@@ 116-131 (lines=16) @@
113
     *
114
     * @return array of string
115
     */
116
    public function getDomains()
117
    {
118
        $q = $this->getEntityManager()->createQueryBuilder()
119
            ->select('e.domain as domain')
120
            ->from($this->getEntityName(), 'e')
121
            ->distinct()
122
            ->orderBy('e.domain ', 'asc')
123
            ->getQuery();
124
125
        $result = array();
126
        foreach ($q->execute() as $next) {
127
            $result[] = $next['domain'];
128
        }
129
130
        return $result;
131
    }
132
133
    /**
134
     * Get distinct list of email recipients.
@@ 138-153 (lines=16) @@
135
     *
136
     * @return array of string
137
     */
138
    public function getRecipients()
139
    {
140
        $q = $this->getEntityManager()->createQueryBuilder()
141
            ->select('e.recipient as recipient')
142
            ->from($this->getEntityName(), 'e')
143
            ->distinct()
144
            ->orderBy('e.recipient ', 'asc')
145
            ->getQuery();
146
147
        $result = array();
148
        foreach ($q->execute() as $next) {
149
            $result[] = $next['recipient'];
150
        }
151
152
        return $result;
153
    }
154
155
    /**
156
     * Get last known sender IP based on stored events list.