Code Duplication    Length = 3-7 lines in 6 locations

includes/Helpers/BotMediaWikiClient.php 1 location

@@ 126-128 (lines=3) @@
123
124
        $response = $this->callApi($tokenParams, 'POST');
125
126
        if (isset($response->error)) {
127
            throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
128
        }
129
130
        $token = $response->query->tokens->logintoken;
131

includes/Helpers/MediaWikiHelper.php 5 locations

@@ 60-62 (lines=3) @@
57
58
        $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST');
59
60
        if (isset($response->error)) {
61
            throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
62
        }
63
64
        $token = $response->query->tokens->createaccounttoken;
65
@@ 88-90 (lines=3) @@
85
86
        $createResponse = $this->mediaWikiClient->doApiCall($createParams, 'POST');
87
88
        if (isset($createResponse->error)) {
89
            throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
90
        }
91
92
        if (!isset($createResponse->createaccount) || !isset($createResponse->createaccount->status)) {
93
            throw new MediaWikiApiException('Unknown error creating account');
@@ 128-130 (lines=3) @@
125
126
        $response = $this->mediaWikiClient->doApiCall($tokenParams, 'POST');
127
128
        if (isset($response->error)) {
129
            throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
130
        }
131
132
        $token = $response->query->tokens->csrftoken;
133
@@ 154-160 (lines=7) @@
151
152
        $response = $this->mediaWikiClient->doApiCall($editParameters, 'POST');
153
154
        if (!isset($response->edit)) {
155
            if (isset($response->error)) {
156
                throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
157
            }
158
159
            throw new MediaWikiApiException('Unknown error encountered during editing.');
160
        }
161
162
        $editResponse = $response->edit;
163
        if ($editResponse->result === "Success") {
@@ 181-183 (lines=3) @@
178
179
        $response = $this->mediaWikiClient->doApiCall($params, 'GET');
180
181
        if (isset($response->error)) {
182
            throw new MediaWikiApiException($response->error->code . ': ' . $response->error->info);
183
        }
184
185
        $requests = $response->query->authmanagerinfo->requests;
186