Code Duplication    Length = 16-16 lines in 2 locations

src/lib/eveApi.php 2 locations

@@ 275-290 (lines=16) @@
272
 * @return mixed
273
 */
274
////Alliance ID to name via CCP
275
function allianceName($allianceID)
276
{
277
    $url = "https://esi.tech.ccp.is/latest/alliances/{$allianceID}/";
278
    $json = file_get_contents($url);
279
    $data = json_decode($json, TRUE);
280
    $name = (string) $data['alliance_name'];
281
    if (null === $name || '' === $name) { // Make sure it's always set.
282
        $url = "https://api.eveonline.com/eve/CharacterName.xml.aspx?ids={$allianceID}";
283
        $xml = makeApiRequest($url);
284
        foreach ($xml->result->rowset->row as $entity) {
285
            $name = $entity->attributes()->name;
286
        }
287
    }
288
289
    return $name;
290
}
291
292
/**
293
 * @param string $systemName
@@ 317-332 (lines=16) @@
314
 * @return mixed
315
 */
316
////TypeID to TypeName via CCP
317
function apiTypeName($typeID)
318
{
319
    $url = "https://esi.tech.ccp.is/latest/universe/types/{$typeID}/";
320
    $json = file_get_contents($url);
321
    $data = json_decode($json, TRUE);
322
    $name = (string) $data['type_name'];
323
    if (null === $name || '' === $name) { // Make sure it's always set.
324
        $url = "https://api.eveonline.com/eve/TypeName.xml.aspx?ids={$typeID}";
325
        $xml = makeApiRequest($url);
326
        foreach ($xml->result->rowset->row as $entity) {
327
            $name = $entity->attributes()->typeName;
328
        }
329
    }
330
331
    return $name;
332
}
333
334
/**
335
 * @param string $typeName