Code Duplication    Length = 11-11 lines in 2 locations

src/repository/MemberDataSharingRepository.php 1 location

@@ 268-278 (lines=11) @@
265
266
        $repositoryResponse = RepositoryResponse::fromResponse($response);
267
268
        if ($repositoryResponse->isSuccessful()) {
269
            $stream = $response->getBody();
270
            $responseContent = json_decode($stream->getContents(), true);
271
            $stream->rewind();
272
273
            if (!(isset($responseContent['response']['member_data_sharing']['id']))) {
274
                throw RepositoryException::wrongFormat(serialize($responseContent));
275
            }
276
277
            $mSharing->setId($responseContent['response']['member_data_sharing']['id']);
278
        }
279
280
        return $repositoryResponse;
281
    }

src/repository/SegmentRepository.php 1 location

@@ 91-101 (lines=11) @@
88
89
        $repositoryResponse = RepositoryResponse::fromResponse($response);
90
91
        if ($repositoryResponse->isSuccessful()) {
92
            $stream = $response->getBody();
93
            $responseContent = json_decode($stream->getContents(), true);
94
            $stream->rewind();
95
96
            if (!(isset($responseContent['response']['segment']['id']))) {
97
                throw RepositoryException::wrongFormat(serialize($responseContent));
98
            }
99
100
            $segment->setId($responseContent['response']['segment']['id']);
101
        }
102
103
        return $repositoryResponse;
104
    }