Code Duplication    Length = 17-17 lines in 2 locations

src/Package/Directory.php 1 location

@@ 35-51 (lines=17) @@
32
	 *
33
	 * @return ResponseInterface
34
	 */
35
	public function add(string $name, bool $isBranch = false, string $branch = '') : ResponseInterface
36
	{
37
		$parameters = ['name' => $name];
38
39
		if ($isBranch)
40
		{
41
			$parameters['is_branch'] = '1';
42
		}
43
44
		if ($branch)
45
		{
46
			$parameters['branch'] = $branch;
47
		}
48
49
		return $this->getHttpClient()
50
			->post($this->getBasePath('add-directory'), ['form_params' => $parameters]);
51
	}
52
53
	/**
54
	 * Rename directory or modify its attributes.

src/Package/File.php 1 location

@@ 74-90 (lines=17) @@
71
	 *
72
	 * @return ResponseInterface
73
	 */
74
	public function update(Languagefile $languagefile, $branch = '') : ResponseInterface
75
	{
76
		$data = [];
77
78
		if ($branch)
79
		{
80
			$data[] = [
81
				'name'     => 'branch',
82
				'contents' => $branch
83
			];
84
		}
85
86
		$data = $this->processLanguageFile($data, $languagefile);
87
88
		return $this->getHttpClient()
89
			->post($this->getBasePath('update-file'), ['multipart' => $data]);
90
	}
91
92
	/**
93
	 * Delete file from Crowdin project. All the translations will be lost without ability to restore them.