Code Duplication    Length = 7-11 lines in 2 locations

src/MusicBrainz/HttpAdapters/RequestsHttpAdapter.php 1 location

@@ 57-63 (lines=7) @@
54
        );
55
56
        $requestOptions = array();
57
        if ($isAuthRequired) {
58
            if ($options['user'] != null && $options['password'] != null) {
59
                $requestOptions['auth'] = array($options['user'], $options['password']);
60
            } else {
61
                throw new Exception('Authentication is required');
62
            }
63
        }
64
        $request = Requests::get($url, $headers, $requestOptions);
65
66
        // musicbrainz throttle

src/MusicBrainz/HttpAdapters/GuzzleFiveAdapter.php 1 location

@@ 55-65 (lines=11) @@
52
            'query' => $params
53
        ];
54
55
        if ($isAuthRequired) {
56
            if ($options['user'] != null && $options['password'] != null) {
57
                $requestOptions['auth'] = [
58
                    'username' => $options['user'],
59
                    'password' => $options['password'],
60
                    CURLAUTH_DIGEST
61
                ];
62
            } else {
63
                throw new Exception('Authentication is required');
64
            }
65
        }
66
67
        $request = $this->client->createRequest('GET', $this->endpoint . '/' . $path, $requestOptions);
68