Code Duplication    Length = 50-50 lines in 2 locations

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

@@ 13-62 (lines=50) @@
10
 * @author Julien Janvier <[email protected]>
11
 * @see https://crowdin.com/page/api/delete-directory
12
 */
13
class DeleteDirectory extends AbstractApi
14
{
15
    /** @var string */
16
    protected $directory;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function execute()
22
    {
23
        if (null == $this->directory) {
24
            throw new InvalidArgumentException('There is no directory to delete.');
25
        }
26
27
        $this->addUrlParameter('key', $this->client->getProjectApiKey());
28
        
29
        $path = sprintf(
30
            "project/%s/delete-directory?%s",
31
            $this->client->getProjectIdentifier(),
32
            $this->getUrlQueryString()
33
        );
34
35
        $parameters = ['name' => $this->directory];
36
37
        $data = ['form_params' => $parameters];
38
        $response = $this->client->getHttpClient()->post($path, $data);
39
40
        return $response->getBody();
41
    }
42
43
    /**
44
     * @param string $directory
45
     *
46
     * @return DeleteDirectory
47
     */
48
    public function setDirectory($directory)
49
    {
50
        $this->directory = $directory;
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getDirectory()
59
    {
60
        return $this->directory;
61
    }
62
}
63

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

@@ 13-62 (lines=50) @@
10
 * @author Julien Janvier <[email protected]>
11
 * @see https://crowdin.com/page/api/delete-file
12
 */
13
class DeleteFile extends AbstractApi
14
{
15
    /** @var string */
16
    protected $file;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function execute()
22
    {
23
        if (null == $this->file) {
24
            throw new InvalidArgumentException('There is no file to delete.');
25
        }
26
27
        $this->addUrlParameter('key', $this->client->getProjectApiKey());
28
        
29
        $path = sprintf(
30
            "project/%s/delete-file?%s",
31
            $this->client->getProjectIdentifier(),
32
            $this->getUrlQueryString()
33
        );
34
35
        $parameters = ['file' => $this->file];
36
37
        $data = ['form_params' => $parameters];
38
        $response = $this->client->getHttpClient()->post($path, $data);
39
40
        return $response->getBody();
41
    }
42
43
    /**
44
     * @param mixed $file
45
     *
46
     * @return DeleteFile
47
     */
48
    public function setFile($file)
49
    {
50
        $this->file = $file;
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return mixed
57
     */
58
    public function getFile()
59
    {
60
        return $this->file;
61
    }
62
}
63