Code Duplication    Length = 12-12 lines in 2 locations

src/V1/OmsApi.php 1 location

@@ 95-106 (lines=12) @@
92
        return (string) $result->getBody();
93
    }
94
95
    private function handleRequestException(\Throwable $exception): OmsClientExceptionInterface
96
    {
97
        if ($exception instanceof BadResponseException) {
98
            $response = $exception->getResponse();
99
            $responseBody = $response ? (string) $response->getBody() : '';
100
            $responseCode = $response ? $response->getStatusCode() : 0;
101
102
            return OmsRequestErrorException::becauseOfError($responseCode, $responseBody, $exception);
103
        }
104
105
        return OmsGeneralErrorException::becauseOfError($exception);
106
    }
107
}
108

src/V2/OmsApi.php 1 location

@@ 141-152 (lines=12) @@
138
        return (string)$result->getBody();
139
    }
140
141
    private function handleRequestException(\Throwable $exception): OmsClientExceptionInterface
142
    {
143
        if ($exception instanceof BadResponseException) {
144
            $response = $exception->getResponse();
145
            $responseBody = $response ? (string)$response->getBody() : '';
146
            $responseCode = $response ? $response->getStatusCode() : 0;
147
148
            return OmsRequestErrorException::becauseOfError($responseCode, $responseBody, $exception);
149
        }
150
151
        return OmsGeneralErrorException::becauseOfError($exception);
152
    }
153
}
154