Code Duplication    Length = 17-17 lines in 2 locations

src/plugins/onMessage/auth.php 2 locations

@@ 155-171 (lines=17) @@
152
                }
153
                foreach ($xml->result->rowset->row as $character) {
154
                    $eveName = $character->attributes()->name;
155
                    if ($corpid === $this->corpID) {
156
                        $roles = $this->message->getFullChannelAttribute()->getGuildAttribute()->getRolesAttribute();
157
                        $member = $this->message->getFullChannelAttribute()->getGuildAttribute()->getMembersAttribute()->get('id', $userID);
158
                        foreach ($roles as $role) {
159
                            $roleName = $role->name;
160
                            if ($roleName == $this->roleName) {
161
                                $member->addRole($role);
162
                                $member->save();
163
                                insertUser($this->db, $this->dbUser, $this->dbPass, $this->dbName, $userID, $charid, $eveName, 'corp');
164
                                disableReg($this->db, $this->dbUser, $this->dbPass, $this->dbName, $code);
165
                                $this->message->reply('**Success:** You have now been added to the '.$this->roleName.' group. To get more roles, talk to the CEO / Directors');
166
                                $this->logger->addInfo('User authed and added to corp group '.$eveName);
167
168
                                return;
169
                            }
170
                        }
171
                    }
172
                    if ($allianceid === $this->allianceID) {
173
                        $roles = $this->message->getFullChannelAttribute()->getGuildAttribute()->getRolesAttribute();
174
                        $member = $this->message->getFullChannelAttribute()->getGuildAttribute()->getMembersAttribute()->get('id', $userID);
@@ 172-188 (lines=17) @@
169
                            }
170
                        }
171
                    }
172
                    if ($allianceid === $this->allianceID) {
173
                        $roles = $this->message->getFullChannelAttribute()->getGuildAttribute()->getRolesAttribute();
174
                        $member = $this->message->getFullChannelAttribute()->getGuildAttribute()->getMembersAttribute()->get('id', $userID);
175
                        foreach ($roles as $role) {
176
                            $roleName = $role->name;
177
                            if ($roleName == $this->allyroleName) {
178
                                $member->addRole($role);
179
                                $member->save();
180
                                insertUser($this->db, $this->dbUser, $this->dbPass, $this->dbName, $userID, $charid, $eveName, 'ally');
181
                                disableReg($this->db, $this->dbUser, $this->dbPass, $this->dbName, $code);
182
                                $this->message->reply('**Success:** You have now been added to the '.$this->allyroleName.' group. To get more roles, talk to the CEO / Directors');
183
                                $this->logger->addInfo('User authed and added to the alliance group '.$eveName);
184
185
                                return;
186
                            }
187
                        }
188
                    }
189
                    $this->message->reply('**Failure:** There are no roles available for your corp/alliance.');
190
                    $this->logger->addInfo('User was denied due to not being in the correct corp or alliance '.$eveName);
191