Code Duplication    Length = 15-16 lines in 3 locations

Entity/Repositories/MailgunEventRepository.php 3 locations

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