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

@@ 110-121 (lines=12) @@
107
        return (string)$result->getBody();
108
    }
109
110
    private function handleRequestException(\Throwable $exception): OmsClientExceptionInterface
111
    {
112
        if ($exception instanceof BadResponseException) {
113
            $response = $exception->getResponse();
114
            $responseBody = $response ? (string)$response->getBody() : '';
115
            $responseCode = $response ? $response->getStatusCode() : 0;
116
117
            return OmsRequestErrorException::becauseOfError($responseCode, $responseBody, $exception);
118
        }
119
120
        return OmsGeneralErrorException::becauseOfError($exception);
121
    }
122
}
123