Code Duplication    Length = 16-16 lines in 3 locations

src/Api/Key.php 1 location

@@ 35-50 (lines=16) @@
32
     *
33
     * @return KeyCreated|ResponseInterface
34
     */
35
    public function create(string $projectKey, string $name, array $params = [])
36
    {
37
        $params['name'] = $name;
38
39
        $response = $this->httpPost(sprintf('/api/v2/projects/%s/keys', $projectKey), $params);
40
41
        if (!$this->hydrator) {
42
            return $response;
43
        }
44
45
        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
46
            $this->handleErrors($response);
47
        }
48
49
        return $this->hydrator->hydrate($response, KeyCreated::class);
50
    }
51
52
    /**
53
     * Search keys.

src/Api/Locale.php 1 location

@@ 34-49 (lines=16) @@
31
     *
32
     * @return string|ResponseInterface
33
     */
34
    public function download(string $projectKey, string $localeId, string $ext, array $params = [])
35
    {
36
        $params['file_format'] = $ext;
37
38
        $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/download', $projectKey, $localeId), $params);
39
40
        if (!$this->hydrator) {
41
            return $response;
42
        }
43
44
        if ($response->getStatusCode() !== 200) {
45
            $this->handleErrors($response);
46
        }
47
48
        return (string) $response->getBody();
49
    }
50
}
51

src/Api/Translation.php 1 location

@@ 102-117 (lines=16) @@
99
     *
100
     * @return TranslationUpdated|ResponseInterface
101
     */
102
    public function update(string $projectKey, string $translationId, string $content, array $params = [])
103
    {
104
        $params['content'] = $content;
105
106
        $response = $this->httpPatch(sprintf('/api/v2/projects/%s/translations/%s', $projectKey, $translationId), $params);
107
108
        if (!$this->hydrator) {
109
            return $response;
110
        }
111
112
        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
113
            $this->handleErrors($response);
114
        }
115
116
        return $this->hydrator->hydrate($response, TranslationUpdated::class);
117
    }
118
119
    /**
120
     * List translations for a specific key.