From c94870e1c38317014dfb10af77e4e4e5e3aef477 Mon Sep 17 00:00:00 2001 From: brantje Date: Fri, 30 Sep 2016 20:49:35 +0200 Subject: [PATCH] Clean up code --- controller/vaultcontroller.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/controller/vaultcontroller.php b/controller/vaultcontroller.php index c908f5c0..191d1d9a 100644 --- a/controller/vaultcontroller.php +++ b/controller/vaultcontroller.php @@ -46,17 +46,15 @@ class VaultController extends ApiController { foreach($vaults as $vault){ $credential = $this->credentialService->getRandomCredentialByVaultId($vault->getId(), $this->userId); $secret_field = $protected_credential_fields[array_rand($protected_credential_fields)]; - $challenge_password = $credential->{$secret_field}(); - $vault = array( + array_push($result, array( 'vault_id' => $vault->getId(), 'guid' => $vault->getGuid(), 'name' => $vault->getName(), 'created' => $vault->getCreated(), 'public_sharing_key' => $vault->getPublicSharingKey(), 'last_access' => $vault->getlastAccess(), - 'challenge_password' => $challenge_password - ); - array_push($result, $vault); + 'challenge_password' => $credential->{$secret_field}() + )); } return new JSONResponse($result);