Code Duplication    Length = 19-19 lines in 2 locations

src/Api/Translation.php 2 locations

@@ 36-54 (lines=19) @@
33
     *
34
     * @return Index|ResponseInterface
35
     */
36
    public function indexLocale(string $projectKey, string $localeId, array $params = [])
37
    {
38
        if (isset($params['tags'])) {
39
            $params['q'] = 'tags:'.$params['tags'];
40
            unset($params['tags']);
41
        }
42
43
        $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/translations', $projectKey, $localeId), $params);
44
45
        if (!$this->hydrator) {
46
            return $response;
47
        }
48
49
        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
50
            $this->handleErrors($response);
51
        }
52
53
        return $this->hydrator->hydrate($response, Index::class);
54
    }
55
56
    /**
57
     * Create a translation.
@@ 131-149 (lines=19) @@
128
     *
129
     * @return Index|ResponseInterface
130
     */
131
    public function indexKey(string $projectKey, string $keyId, array $params = [])
132
    {
133
        if (isset($params['tags'])) {
134
            $params['q'] = 'tags:'.$params['tags'];
135
            unset($params['tags']);
136
        }
137
138
        $response = $this->httpGet(sprintf('/api/v2/projects/%s/keys/%s/translations', $projectKey, $keyId), $params);
139
140
        if (!$this->hydrator) {
141
            return $response;
142
        }
143
144
        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
145
            $this->handleErrors($response);
146
        }
147
148
        return $this->hydrator->hydrate($response, Index::class);
149
    }
150
}
151