Code Duplication    Length = 23-23 lines in 2 locations

src/CurlRemoteFilesystem.php 2 locations

@@ 250-272 (lines=23) @@
247
        $io = $this->io;
248
        $httpCode = $res->info['http_code'];
249
250
        if ('github' === $req->special) {
251
            $message = "\nCould not fetch {$req->getURL()}, please create a GitHub OAuth token ";
252
            if (404 === $httpCode) {
253
                $message .= 'to access private repos';
254
            } else {
255
                $message .= 'to go over the API rate limit';
256
            }
257
            $github = new Util\GitHub($io, $this->config, null);
258
            if ($github->authorizeOAuth($req->origin)) {
259
                $this->retry = true;
260
                return;
261
            }
262
            if ($io->isInteractive() &&
263
                $github->authorizeOAuthInteractively($req->origin, $message)) {
264
                $this->retry = true;
265
                return;
266
            }
267
268
            throw new Downloader\TransportException(
269
                "Could not authenticate against $req->origin",
270
                401
271
            );
272
        }
273
        
274
        if ('gitlab' === $req->special) {
275
            $message = "\nCould not fetch {$req->getURL()}, enter your $req->origin credentials ";
@@ 274-296 (lines=23) @@
271
            );
272
        }
273
        
274
        if ('gitlab' === $req->special) {
275
            $message = "\nCould not fetch {$req->getURL()}, enter your $req->origin credentials ";
276
            if (401 === $httpCode) {
277
                $message .= 'to access private repos';
278
            } else {
279
                $message .= 'to go over the API rate limit';
280
            }
281
            $gitlab = new Util\GitLab($io, $this->config, null);
282
            if ($gitlab->authorizeOAuth($req->origin)) {
283
                $this->retry = true;
284
                return;
285
            }
286
            if ($io->isInteractive() &&
287
                $gitlab->authorizeOAuthInteractively($req->origin, $message)) {
288
                $this->retry = true;
289
                return;
290
            }
291
292
            throw new Downloader\TransportException(
293
                "Could not authenticate against $req->origin",
294
                401
295
            );
296
        }
297
298
        // 404s are only handled for github
299
        if (404 === $httpCode) {