Reducing the complexity of ProjectController::add()

This commit is contained in:
Dan Cryer 2014-05-09 16:19:15 +01:00
parent aab931c293
commit 66772d3bf1

View file

@ -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())) {