Code Duplication    Length = 28-28 lines in 2 locations

src/lib/eveApi.php 2 locations

@@ 165-192 (lines=28) @@
162
 * @return mixed
163
 */
164
////Char ID to char data via CCP
165
function characterDetails($characterID)
166
{
167
    $logger = new Logger('eveESI');
168
    $logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG));
169
170
    try {
171
        // Initialize a new request for this URL
172
        $ch = curl_init("https://esi.tech.ccp.is/latest/characters/{$characterID}/");
173
        // Set the options for this request
174
        curl_setopt_array($ch, array(
175
            CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect
176
            CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data
177
            CURLOPT_TIMEOUT => 8,
178
            CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate
179
        ));
180
        // Fetch the data from the URL
181
        $data = curl_exec($ch);
182
        // Close the connection
183
        curl_close($ch);
184
        $data = json_decode($data, TRUE);
185
186
    } catch (Exception $e) {
187
        $logger->error('EVE ESI Error: ' . $e->getMessage());
188
        return null;
189
    }
190
191
    return $data;
192
}
193
194
/**
195
 * @param string $systemID
@@ 370-397 (lines=28) @@
367
 * @return mixed
368
 */
369
////Corp ID to corp data via CCP
370
function corpDetails($corpID)
371
{
372
    $logger = new Logger('eveESI');
373
    $logger->pushHandler(new StreamHandler(__DIR__ . '/../../log/libraryError.log', Logger::DEBUG));
374
375
    try {
376
        // Initialize a new request for this URL
377
        $ch = curl_init("https://esi.tech.ccp.is/latest/corporations/{$corpID}/");
378
        // Set the options for this request
379
        curl_setopt_array($ch, array(
380
            CURLOPT_FOLLOWLOCATION => true, // Yes, we want to follow a redirect
381
            CURLOPT_RETURNTRANSFER => true, // Yes, we want that curl_exec returns the fetched data
382
            CURLOPT_TIMEOUT => 8,
383
            CURLOPT_SSL_VERIFYPEER => true, // Do not verify the SSL certificate
384
        ));
385
        // Fetch the data from the URL
386
        $data = curl_exec($ch);
387
        // Close the connection
388
        curl_close($ch);
389
        $data = json_decode($data, TRUE);
390
391
    } catch (Exception $e) {
392
        $logger->error('EVE ESI Error: ' . $e->getMessage());
393
        return null;
394
    }
395
396
    return $data;
397
}
398
399
/**
400
 * @param string $allianceID