/** * @inheritdoc */ public function saveGit() { $client = new Client($this->enterpriseUrl); $client->authenticate($this->authKey, Client::AUTH_URL_TOKEN); $projects = $client->getHttpClient()->get('projects/')->getContent(); foreach ($projects as $data) { if ($data['path_with_namespace'] == $this->owner . '/' . $this->repository) { $id = $data['id']; break; } } if (!isset($id)) { throw new HttpException(404, "Repository " . $this->repository . " not found."); } /** * @var Project $project */ $project = Project::fromArray($client, compact('id')); $project->updateFile($this->remotePath, $this->content, 'master', $this->comment); return true; }
/** * @param string $path * @param array $parameters * @param array $requestHeaders * @return mixed */ protected function delete($path, array $parameters = array(), $requestHeaders = array()) { $response = $this->client->getHttpClient()->delete($path, $parameters, $requestHeaders); return $response->getContent(); }