Code Duplication    Length = 18-18 lines in 2 locations

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

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

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

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