Reducing the complexity of ProjectController::add()
This commit is contained in:
parent
aab931c293
commit
66772d3bf1
|
@ -227,22 +227,20 @@ class ProjectController extends \PHPCI\Controller
|
|||
|
||||
$this->config->set('page_title', 'Edit: ' . $project->getTitle());
|
||||
|
||||
$values = $project->getDataArray();
|
||||
$values['key'] = $values['git_key'];
|
||||
$values['pubkey'] = $values['public_key'];
|
||||
|
||||
if ($values['type'] == "gitlab") {
|
||||
$accessInfo = $project->getAccessInformation();
|
||||
$reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $project->getReference().".git";
|
||||
$values['reference'] = $reference;
|
||||
}
|
||||
|
||||
if ($method == 'POST') {
|
||||
$values = $this->getParams();
|
||||
} else {
|
||||
$values = $project->getDataArray();
|
||||
$values['key'] = $values['git_key'];
|
||||
$values['pubkey'] = $values['public_key'];
|
||||
|
||||
if ($values['type'] == "gitlab") {
|
||||
$accessInfo = $project->getAccessInformation();
|
||||
$reference = $accessInfo["user"].'@'.$accessInfo["domain"].':' . $project->getReference().".git";
|
||||
$values['reference'] = $reference;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$form = $this->projectForm($values, 'edit/' . $projectId);
|
||||
|
||||
if ($method != 'POST' || ($method == 'POST' && !$form->validate())) {
|
||||
|
|
Loading…
Reference in a new issue