Fixing ProjectController::add() complexity

This commit is contained in:
Dan Cryer 2014-07-11 15:38:28 +01:00
parent 8b0261417a
commit 5d4db6a5bd
2 changed files with 11 additions and 3 deletions

View file

@ -163,9 +163,9 @@ class ProjectController extends \PHPCI\Controller
$sshKey = new SshKey();
$key = $sshKey->generate();
$values['key'] = isset($key['private_key']) ? $key['private_key'] : '';
$values['pubkey'] = isset($key['public_key']) ? $key['public_key'] : '';
$pub = isset($key['public_key']) ? $key['public_key'] : '';
$values['key'] = $key['private_key'];
$values['pubkey'] = $key['public_key'];
$pub = $key['public_key'];
}
$form = $this->projectForm($values);

View file

@ -37,6 +37,14 @@ class SshKey
$pub = file_get_contents($keyFile . '.pub');
$prv = file_get_contents($keyFile);
if (empty($pub)) {
$pub = '';
}
if (empty($prv)) {
$prv = '';
}
$return = array('private_key' => $prv, 'public_key' => $pub);
}