Code Duplication    Length = 18-18 lines in 2 locations

src/Akeneo/Crowdin/Api/AddFile.php 1 location

@@ 68-85 (lines=18) @@
65
                'contents'  => $this->branch
66
            ];
67
        }
68
        foreach ($this->translations as $translation) {
69
            $data[] = [
70
                'name'      => 'files['.$translation->getCrowdinPath().']',
71
                'contents'  => $this->fileReader->readTranslation($translation)
72
            ];
73
            if ($translation->getTitle()) {
74
                $data[] = [
75
                    'name'      => 'titles['.$translation->getCrowdinPath().']',
76
                    'contents'  => $translation->getTitle()
77
                ];
78
            }
79
            if ($translation->getExportPattern()) {
80
                $data[] = [
81
                    'name'      => 'export_patterns['.$translation->getCrowdinPath().']',
82
                    'contents'  => $translation->getExportPattern()
83
                ];
84
            }
85
        }
86
87
        $data = ['multipart' => $data];
88
        $response = $this->client->getHttpClient()->post($path, $data);

src/Akeneo/Crowdin/Api/UpdateFile.php 1 location

@@ 59-76 (lines=18) @@
56
            ];
57
        }
58
59
        foreach ($this->translations as $translation) {
60
            $data[] = [
61
                'name'      => 'files['.$translation->getCrowdinPath().']',
62
                'contents'  => $this->fileReader->readTranslation($translation)
63
            ];
64
            if ($translation->getTitle()) {
65
                $data[] = [
66
                    'name'      => 'titles['.$translation->getCrowdinPath().']',
67
                    'contents'  => $translation->getTitle()
68
                ];
69
            }
70
            if ($translation->getExportPattern()) {
71
                $data[] = [
72
                    'name'      => 'export_patterns['.$translation->getCrowdinPath().']',
73
                    'contents'  => $translation->getExportPattern()
74
                ];
75
            }
76
        }
77
78
        $data = ['multipart' => $data];
79
        $response = $this->client->getHttpClient()->post($path, $data);