| @@ 33-49 (lines=17) @@ | ||
| 30 | * |
|
| 31 | * @return \Psr\Http\Message\ResponseInterface |
|
| 32 | */ |
|
| 33 | public function add($name, $isBranch = false, $branch = '') |
|
| 34 | { |
|
| 35 | $parameters = ['name' => $name]; |
|
| 36 | ||
| 37 | if ($isBranch) |
|
| 38 | { |
|
| 39 | $parameters['is_branch'] = '1'; |
|
| 40 | } |
|
| 41 | ||
| 42 | if ('' !== $branch) |
|
| 43 | { |
|
| 44 | $parameters['branch'] = $branch; |
|
| 45 | } |
|
| 46 | ||
| 47 | return $this->getHttpClient() |
|
| 48 | ->post($this->getBasePath('add-directory'), ['form_params' => $parameters]); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Rename directory or modify its attributes. |
|
| @@ 70-86 (lines=17) @@ | ||
| 67 | * |
|
| 68 | * @return \Psr\Http\Message\ResponseInterface |
|
| 69 | */ |
|
| 70 | public function update(Languagefile $languagefile, $branch = '') |
|
| 71 | { |
|
| 72 | $data = []; |
|
| 73 | ||
| 74 | if ('' !== $branch) |
|
| 75 | { |
|
| 76 | $data[] = [ |
|
| 77 | 'name' => 'branch', |
|
| 78 | 'contents' => $branch |
|
| 79 | ]; |
|
| 80 | } |
|
| 81 | ||
| 82 | $data = $this->processLanguageFile($data, $languagefile); |
|
| 83 | ||
| 84 | return $this->getHttpClient() |
|
| 85 | ->post($this->getBasePath('update-file'), ['multipart' => $data]); |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Delete file from Crowdin project. All the translations will be lost without ability to restore them. |
|