@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param IUserManager $userManager |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public static function getNameByUid(string $uid, IUserManager $userManager){ |
|
61 | + public static function getNameByUid(string $uid, IUserManager $userManager) { |
|
62 | 62 | $u = $userManager->get($uid); |
63 | 63 | return $u->getDisplayName(); |
64 | 64 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * @param array $results |
69 | 69 | * @return array|mixed |
70 | 70 | */ |
71 | - public static function getDirContents(string $dir, &$results = array()){ |
|
71 | + public static function getDirContents(string $dir, &$results = array()) { |
|
72 | 72 | $files = scandir($dir); |
73 | 73 | |
74 | - foreach($files as $value){ |
|
75 | - $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
|
76 | - if(!is_dir($path)) { |
|
74 | + foreach ($files as $value) { |
|
75 | + $path = realpath($dir . DIRECTORY_SEPARATOR . $value); |
|
76 | + if (!is_dir($path)) { |
|
77 | 77 | $results[] = $path; |
78 | - } else if($value != "." && $value != "..") { |
|
78 | + } else if ($value != "." && $value != "..") { |
|
79 | 79 | Utils::getDirContents($path, $results); |
80 | 80 | $results[] = $path; |
81 | 81 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function moveCredentials($source_account, $destination_account) { |
82 | 82 | $succeed = false; |
83 | - if ($source_account != $destination_account){ |
|
83 | + if ($source_account != $destination_account) { |
|
84 | 84 | $vaults = $this->vaultService->getByUser($source_account); |
85 | 85 | foreach ($vaults as $vault) { |
86 | 86 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $source_account); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | return new JSONResponse(array('success' => $succeed)); |
119 | 119 | } |
120 | 120 | |
121 | - public function listRequests(){ |
|
121 | + public function listRequests() { |
|
122 | 122 | $requests = $this->deleteVaultRequestService->getDeleteRequests(); |
123 | 123 | $results = array(); |
124 | - foreach($requests as $request){ |
|
124 | + foreach ($requests as $request) { |
|
125 | 125 | $r = $request->jsonSerialize(); |
126 | 126 | $r['displayName'] = Utils::getNameByUid($request->getRequestedBy(), $this->userManager); |
127 | 127 | array_push($results, $r); |
@@ -129,28 +129,28 @@ discard block |
||
129 | 129 | return new JSONResponse($results); |
130 | 130 | } |
131 | 131 | |
132 | - public function acceptRequestDeletion($vault_guid, $requested_by){ |
|
132 | + public function acceptRequestDeletion($vault_guid, $requested_by) { |
|
133 | 133 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
134 | - try{ |
|
134 | + try { |
|
135 | 135 | $vault = $this->vaultService->getByGuid($vault_guid, $requested_by); |
136 | - } catch (\Exception $e){ |
|
136 | + } catch (\Exception $e) { |
|
137 | 137 | //Ignore |
138 | 138 | } |
139 | 139 | |
140 | - if(isset($vault)){ |
|
140 | + if (isset($vault)) { |
|
141 | 141 | $credentials = $this->credentialService->getCredentialsByVaultId($vault->getId(), $requested_by); |
142 | - foreach($credentials as $credential){ |
|
142 | + foreach ($credentials as $credential) { |
|
143 | 143 | $revisions = $this->revisionService->getRevisions($credential->getId()); |
144 | - foreach($revisions as $revision){ |
|
144 | + foreach ($revisions as $revision) { |
|
145 | 145 | $this->revisionService->deleteRevision($revision['revision_id'], $requested_by); |
146 | 146 | } |
147 | - if($credential instanceof Credential){ |
|
147 | + if ($credential instanceof Credential) { |
|
148 | 148 | $this->credentialService->deleteCredential($credential); |
149 | 149 | } |
150 | 150 | } |
151 | 151 | $this->vaultService->deleteVault($vault_guid, $requested_by); |
152 | 152 | } |
153 | - if($req instanceof DeleteVaultRequest) { |
|
153 | + if ($req instanceof DeleteVaultRequest) { |
|
154 | 154 | $this->deleteVaultRequestService->removeDeleteRequestForVault($req); |
155 | 155 | } |
156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function requestDeletion($vault_guid, $reason) { |
164 | 164 | $req = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
165 | - if($req){ |
|
165 | + if ($req) { |
|
166 | 166 | return new JSONResponse('Already exists'); |
167 | 167 | } |
168 | 168 | $vault = $this->vaultService->getByGuid($vault_guid, $this->userId); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $result = false; |
188 | 188 | try { |
189 | 189 | $delete_request = $this->deleteVaultRequestService->getDeleteRequestForVault($vault_guid); |
190 | - } catch (\Exception $exception){ |
|
190 | + } catch (\Exception $exception) { |
|
191 | 191 | // Ignore it |
192 | 192 | } |
193 | 193 |