Code Duplication    Length = 7-11 lines in 2 locations

src/MusicBrainz/HttpAdapters/GuzzleFiveAdapter.php 1 location

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

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