Code Duplication    Length = 12-12 lines in 2 locations

src/repository/SegmentRepository.php 2 locations

@@ 67-78 (lines=12) @@
64
65
        $repositoryResponse = RepositoryResponse::fromResponse($response);
66
67
        if ($repositoryResponse->isSuccessful()) {
68
69
            $stream = $response->getBody();
70
            $responseContent = json_decode($stream->getContents(), true);
71
            $stream->rewind();
72
73
            if (!(isset($responseContent['response']['segment']['id']))) {
74
                throw RepositoryException::wrongFormat(serialize($responseContent));
75
            }
76
77
            $segment->setId($responseContent['response']['segment']['id']);
78
        }
79
80
        return $repositoryResponse;
81
@@ 200-211 (lines=12) @@
197
198
        $repositoryResponse = RepositoryResponse::fromResponse($response);
199
200
        if ($repositoryResponse->isSuccessful()) {
201
202
            $stream = $response->getBody();
203
            $responseContent = json_decode($stream->getContents(), true);
204
            $stream->rewind();
205
206
            if (!(isset($responseContent['response']['segment']['id']))) {
207
                throw RepositoryException::wrongFormat(serialize($responseContent));
208
            }
209
210
            $segment->setId($responseContent['response']['segment']['id']);
211
        }
212
213
        return $repositoryResponse;
214