Code Duplication    Length = 23-23 lines in 2 locations

src/Client.php 2 locations

@@ 161-183 (lines=23) @@
158
     *
159
     * @return array
160
     */
161
    public function authFlush($username = null, $password = null)
162
    {
163
        try {
164
            $response = $this->delete(
165
                '/webservice/auth/token',
166
                [
167
                    'headers' => [
168
                        'Authorization' => $this->bearerOrBasic($username, $password),
169
                    ],
170
                ]
171
            );
172
173
            return [
174
                'status'    => 'ok',
175
                'http_code' => $response->getStatusCode(),
176
                'body'      => (string) $response->getBody(),
177
            ];
178
        } catch (\GuzzleHttp\Exception\ClientException $e) {
179
            return $this->clientError($e);
180
        } catch (\GuzzleHttp\Exception\ServerException $e) {
181
            return $this->parseError($e);
182
        }
183
    }
184
185
    /**
186
     * Authenticate and gets the number of available session tokens.
@@ 195-217 (lines=23) @@
192
     *
193
     * @return array
194
     */
195
    public function authToken($username = null, $password = null)
196
    {
197
        try {
198
            $response = $this->get(
199
                '/webservice/auth/token',
200
                [
201
                    'headers' => [
202
                        'Authorization' => $this->bearerOrBasic($username, $password),
203
                    ],
204
                ]
205
            );
206
207
            return [
208
                'status'    => 'ok',
209
                'http_code' => $response->getStatusCode(),
210
                'body'      => (string) $response->getBody(),
211
            ];
212
        } catch (\GuzzleHttp\Exception\ClientException $e) {
213
            return $this->clientError($e);
214
        } catch (\GuzzleHttp\Exception\ServerException $e) {
215
            return $this->parseError($e);
216
        }
217
    }
218
219
    /**
220
     * Authenticate and request period based cashup reports.