Code Duplication    Length = 25-25 lines in 2 locations

src/plugins/onTick/siphons.php 2 locations

@@ 100-124 (lines=25) @@
97
        $rawGoo = array(16634, 16643, 16647, 16641, 16640, 16635, 16648, 16633, 16646, 16651, 16650, 16644, 16652, 16639, 16636, 16649, 16653, 16638, 16637, 16642);
98
        foreach ($xml->result->rowset->row as $structures) {
99
            //Check silos
100
            if ($structures->attributes()->typeID == 14343) {
101
                if (isset($structures->rowset->row)) {
102
                    foreach ($structures->rowset->row as $silo) {
103
                        //Avoid reporting empty silos
104
                        if ($silo->attributes()->quantity != 0 && in_array($silo->attributes()->typeID, $rawGoo)) {
105
                            //Check for a multiple of 50
106
                            if ($silo->attributes()->quantity % 50 != 0) {
107
                                $gooType = apiTypeName($silo->attributes()->typeID);
108
                                $systemName = apiCharacterName($structures->attributes()->locationID);
109
                                $msg = "{$this->prefix}";
110
                                $msg .= "**POSSIBLE SIPHON**\n";
111
                                $msg .= "**System: **{$systemName} has a possible siphon stealing {$gooType} from a silo.\n";
112
                                // Send the msg to the channel;
113
                                $channelID = $this->toDiscordChannel;
114
                                $guild = $discord->guilds->get('id', $this->guild);
115
                                $channel = $guild->channels->get('id', $channelID);
116
                                $channel->sendMessage($msg, false);
117
                                $this->logger->addInfo($msg);
118
                                $siphonCount++;
119
                                sleep(2); // Lets sleep for a second, so we don't rage spam
120
                            }
121
                        }
122
                    }
123
                }
124
            }
125
            if ($structures->attributes()->typeID == 17982) {
126
                if (isset($structures->rowset->row)) {
127
                    foreach ($structures->rowset->row as $coupling) {
@@ 125-149 (lines=25) @@
122
                    }
123
                }
124
            }
125
            if ($structures->attributes()->typeID == 17982) {
126
                if (isset($structures->rowset->row)) {
127
                    foreach ($structures->rowset->row as $coupling) {
128
                        //Avoid reporting empty coupling arrays
129
                        if ($coupling->attributes()->quantity != 0) {
130
                            //Check for a multiple of 50
131
                            if ($coupling->attributes()->quantity % 50 != 0) {
132
                                $gooType = apiTypeName($silo->attributes()->typeID);
133
                                $systemName = apiCharacterName($structures->attributes()->locationID);
134
                                $msg = "{$this->prefix}";
135
                                $msg .= "**POSSIBLE SIPHON**\n";
136
                                $msg .= "**System: **{$systemName} has a possible siphon stealing {$gooType} from a coupling array.\n";
137
                                // Send the msg to the channel;
138
                                $channelID = $this->toDiscordChannel;
139
                                $guild = $discord->guilds->get('id', $this->guild);
140
                                $channel = $guild->channels->get('id', $channelID);
141
                                $channel->sendMessage($msg, false);
142
                                $this->logger->addInfo($msg);
143
                                $siphonCount++;
144
                                sleep(2); // Lets sleep for a second, so we don't rage spam
145
                            }
146
                        }
147
                    }
148
                }
149
            }
150
        }
151
        $cached = $xml->cachedUntil[0];
152
        $baseUnix = strtotime($cached);