Completed
Pull Request — master (#160)
by Sander
06:15 queued 02:18
created
lib/Service/CredentialService.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 	/**
83 83
 	 * Get credentials by vault id
84
-	 * @param $vault_id
84
+	 * @param integer $vault_id
85 85
 	 * @param $user_id
86 86
 	 * @return \OCA\Passman\Db\Vault[]
87 87
 	 */
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	/**
93 93
 	 * Get a random credential from given vault
94
-	 * @param $vault_id
94
+	 * @param integer $vault_id
95 95
 	 * @param $user_id
96 96
 	 * @return mixed
97 97
 	 */
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	/**
104 104
 	 * Get expired credentials.
105
-	 * @param $timestamp
105
+	 * @param integer $timestamp
106 106
 	 * @return \OCA\Passman\Db\Credential[]
107 107
 	 */
108 108
 	public function getExpiredCredentials($timestamp) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * Get credential label by credential id.
135
-	 * @param $credential_id
135
+	 * @param integer $credential_id
136 136
 	 * @return Credential
137 137
 	 */
138 138
 	public function getCredentialLabelById($credential_id){
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
 class CredentialService {
37 37
 
38 38
 	private $credentialMapper;
39
-    private $sharingACL;
39
+	private $sharingACL;
40 40
 	private $encryptService;
41 41
 	private $server_key;
42 42
 
43 43
 	public function __construct(CredentialMapper $credentialMapper, SharingACLMapper $sharingACL, EncryptService $encryptService) {
44 44
 		$this->credentialMapper = $credentialMapper;
45
-        $this->sharingACL = $sharingACL;
46
-        $this->encryptService = $encryptService;
45
+		$this->sharingACL = $sharingACL;
46
+		$this->encryptService = $encryptService;
47 47
 		$this->server_key = \OC::$server->getConfig()->getSystemValue('passwordsalt', '');
48 48
 	}
49 49
 
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 	 * @throws DoesNotExistException
137 137
 	 */
138 138
 	public function getCredentialById($credential_id, $user_id){
139
-        $credential = $this->credentialMapper->getCredentialById($credential_id);
140
-        if ($credential->getUserId() === $user_id){
141
-            return $credential;
142
-        }
143
-        else {
144
-            $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid());
145
-            if ($acl->hasPermission(SharingACL::READ)) {
139
+		$credential = $this->credentialMapper->getCredentialById($credential_id);
140
+		if ($credential->getUserId() === $user_id){
141
+			return $credential;
142
+		}
143
+		else {
144
+			$acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid());
145
+			if ($acl->hasPermission(SharingACL::READ)) {
146 146
 				return $this->encryptService->decryptCredential($credential);
147 147
 			} else {
148 148
 				throw new DoesNotExistException("Did expect one result but found none when executing");
149 149
 			}
150
-        }
150
+		}
151 151
 	}
152 152
 
153 153
 	/**
@@ -169,5 +169,5 @@  discard block
 block discarded – undo
169 169
 	public function getCredentialByGUID($credential_guid, $user_id = null){
170 170
 		$credential = $this->credentialMapper->getCredentialByGUID($credential_guid);
171 171
 		return $this->encryptService->decryptCredential($credential);
172
-    }
172
+	}
173 173
 }
174 174
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param Credential $credential
84 84
 	 * @return \OCP\AppFramework\Db\Entity
85 85
 	 */
86
-	public function deleteCredential(Credential $credential){
86
+	public function deleteCredential(Credential $credential) {
87 87
 		return $this->credentialMapper->deleteCredential($credential);
88 88
 	}
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function getCredentialsByVaultId($vault_id, $user_id) {
97 97
 		$credentials = $this->credentialMapper->getCredentialsByVaultId($vault_id, $user_id);
98
-		foreach ($credentials as $index => $credential){
98
+		foreach ($credentials as $index => $credential) {
99 99
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
100 100
 		}
101 101
 		return $credentials;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function getRandomCredentialByVaultId($vault_id, $user_id) {
111 111
 		$credentials = $this->credentialMapper->getRandomCredentialByVaultId($vault_id, $user_id);
112
-		foreach ($credentials as $index => $credential){
112
+		foreach ($credentials as $index => $credential) {
113 113
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
114 114
 		}
115 115
 		return array_pop($credentials);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function getExpiredCredentials($timestamp) {
124 124
 		$credentials = $this->credentialMapper->getExpiredCredentials($timestamp);
125
-		foreach ($credentials as $index => $credential){
125
+		foreach ($credentials as $index => $credential) {
126 126
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
127 127
 		}
128 128
 		return $credentials;
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 * @return Credential
136 136
 	 * @throws DoesNotExistException
137 137
 	 */
138
-	public function getCredentialById($credential_id, $user_id){
138
+	public function getCredentialById($credential_id, $user_id) {
139 139
         $credential = $this->credentialMapper->getCredentialById($credential_id);
140
-        if ($credential->getUserId() === $user_id){
140
+        if ($credential->getUserId() === $user_id) {
141 141
             return $credential;
142 142
         }
143 143
         else {
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param $credential_id
156 156
 	 * @return Credential
157 157
 	 */
158
-	public function getCredentialLabelById($credential_id){
159
-		$credential =  $this->credentialMapper->getCredentialLabelById($credential_id);
158
+	public function getCredentialLabelById($credential_id) {
159
+		$credential = $this->credentialMapper->getCredentialLabelById($credential_id);
160 160
 		return $this->encryptService->decryptCredential($credential);
161 161
 	}
162 162
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @param null $user_id
167 167
 	 * @return Credential
168 168
 	 */
169
-	public function getCredentialByGUID($credential_guid, $user_id = null){
169
+	public function getCredentialByGUID($credential_guid, $user_id = null) {
170 170
 		$credential = $this->credentialMapper->getCredentialByGUID($credential_guid);
171 171
 		return $this->encryptService->decryptCredential($credential);
172 172
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param Credential $credential
84 84
 	 * @return \OCP\AppFramework\Db\Entity
85 85
 	 */
86
-	public function deleteCredential(Credential $credential){
86
+	public function deleteCredential(Credential $credential) {
87 87
 		return $this->credentialMapper->deleteCredential($credential);
88 88
 	}
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function getCredentialsByVaultId($vault_id, $user_id) {
97 97
 		$credentials = $this->credentialMapper->getCredentialsByVaultId($vault_id, $user_id);
98
-		foreach ($credentials as $index => $credential){
98
+		foreach ($credentials as $index => $credential) {
99 99
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
100 100
 		}
101 101
 		return $credentials;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function getRandomCredentialByVaultId($vault_id, $user_id) {
111 111
 		$credentials = $this->credentialMapper->getRandomCredentialByVaultId($vault_id, $user_id);
112
-		foreach ($credentials as $index => $credential){
112
+		foreach ($credentials as $index => $credential) {
113 113
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
114 114
 		}
115 115
 		return array_pop($credentials);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function getExpiredCredentials($timestamp) {
124 124
 		$credentials = $this->credentialMapper->getExpiredCredentials($timestamp);
125
-		foreach ($credentials as $index => $credential){
125
+		foreach ($credentials as $index => $credential) {
126 126
 			$credentials[$index] = $this->encryptService->decryptCredential($credential);
127 127
 		}
128 128
 		return $credentials;
@@ -135,12 +135,11 @@  discard block
 block discarded – undo
135 135
 	 * @return Credential
136 136
 	 * @throws DoesNotExistException
137 137
 	 */
138
-	public function getCredentialById($credential_id, $user_id){
138
+	public function getCredentialById($credential_id, $user_id) {
139 139
         $credential = $this->credentialMapper->getCredentialById($credential_id);
140
-        if ($credential->getUserId() === $user_id){
140
+        if ($credential->getUserId() === $user_id) {
141 141
             return $credential;
142
-        }
143
-        else {
142
+        } else {
144 143
             $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid());
145 144
             if ($acl->hasPermission(SharingACL::READ)) {
146 145
 				return $this->encryptService->decryptCredential($credential);
@@ -155,7 +154,7 @@  discard block
 block discarded – undo
155 154
 	 * @param $credential_id
156 155
 	 * @return Credential
157 156
 	 */
158
-	public function getCredentialLabelById($credential_id){
157
+	public function getCredentialLabelById($credential_id) {
159 158
 		$credential =  $this->credentialMapper->getCredentialLabelById($credential_id);
160 159
 		return $this->encryptService->decryptCredential($credential);
161 160
 	}
@@ -166,7 +165,7 @@  discard block
 block discarded – undo
166 165
 	 * @param null $user_id
167 166
 	 * @return Credential
168 167
 	 */
169
-	public function getCredentialByGUID($credential_guid, $user_id = null){
168
+	public function getCredentialByGUID($credential_guid, $user_id = null) {
170 169
 		$credential = $this->credentialMapper->getCredentialByGUID($credential_guid);
171 170
 		return $this->encryptService->decryptCredential($credential);
172 171
     }
Please login to merge, or discard this patch.
lib/Service/EncryptService.php 3 patches
Doc Comments   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -213,6 +213,10 @@  discard block
 block discarded – undo
213 213
 		return array($cipherKey, $macKey, $iv);
214 214
 	}
215 215
 
216
+	/**
217
+	 * @param string $a
218
+	 * @param string $b
219
+	 */
216 220
 	function hash_equals($a, $b) {
217 221
 		$key = openssl_random_pseudo_bytes(128);
218 222
 		return hash_hmac('sha512', $a, $key) === hash_hmac('sha512', $b, $key);
@@ -250,7 +254,7 @@  discard block
 block discarded – undo
250 254
 	/**
251 255
 	 * Pad the data with a random char chosen by the pad amount.
252 256
 	 *
253
-	 * @param $data
257
+	 * @param string $data
254 258
 	 * @return string
255 259
 	 */
256 260
 	protected function pad($data) {
@@ -266,8 +270,8 @@  discard block
 block discarded – undo
266 270
 	/**
267 271
 	 * Unpad the the data
268 272
 	 *
269
-	 * @param $data
270
-	 * @return bool|string
273
+	 * @param string $data
274
+	 * @return false|string
271 275
 	 */
272 276
 	protected function unpad($data) {
273 277
 		$length = $this->getKeySize();
@@ -284,7 +288,7 @@  discard block
 block discarded – undo
284 288
 	 * Encrypt a credential
285 289
 	 *
286 290
 	 * @param array|Credential $credential the credential to decrypt
287
-	 * @return Credential|array
291
+	 * @return string
288 292
 	 */
289 293
 	public function decryptCredential($credential) {
290 294
 
@@ -380,7 +384,7 @@  discard block
 block discarded – undo
380 384
 	/**
381 385
 	 * Decrypt a file
382 386
 	 *
383
-	 * @param  File|array $file
387
+	 * @param  File $file
384 388
 	 * @return File|array
385 389
 	 */
386 390
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
 		$setting = $settings->getAppSetting('server_side_encryption');
104 104
 		$this->cipher = $setting['cipher'];
105 105
 		$this->mode = $setting['mode'];
106
-		$this->rounds = (int)100;
106
+		$this->rounds = (int) 100;
107 107
 		$this->server_key = \OC::$server->getConfig()->getSystemValue('passwordsalt', '');
108 108
 		ini_set('memory_limit', '1024M');
109 109
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,9 @@
 block discarded – undo
272 272
 	protected function unpad($data) {
273 273
 		$length = $this->getKeySize();
274 274
 		$last = ord($data[strlen($data) - 1]);
275
-		if ($last > $length) return false;
275
+		if ($last > $length) {
276
+			return false;
277
+		}
276 278
 		if (substr($data, -1 * $last) !== str_repeat(chr($last), $last)) {
277 279
 			return false;
278 280
 		}
Please login to merge, or discard this patch.
lib/Db/CredentialMapper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		$sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' .
58 58
 			'WHERE `user_id` = ? and vault_id = ? AND shared_key is NULL LIMIT 20';
59 59
 		$entities = $this->findEntities($sql, [$user_id, $vault_id]);
60
-		$count = count($entities)-1;
60
+		$count = count($entities) - 1;
61 61
 		$entities = array_splice($entities, rand(0, $count), 1);
62 62
 		return $entities;
63 63
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @param $timestamp
68 68
 	 * @return Credential[]
69 69
 	 */
70
-	public function getExpiredCredentials($timestamp){
70
+	public function getExpiredCredentials($timestamp) {
71 71
 		$sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' .
72 72
 			'WHERE `expire_time` > 0 AND `expire_time` < ?';
73 73
 		return $this->findEntities($sql, [$timestamp]);
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
      * @param null $user_id
81 81
      * @return Credential
82 82
      */
83
-	public function getCredentialById($credential_id, $user_id = null){
83
+	public function getCredentialById($credential_id, $user_id = null) {
84 84
 		$sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' .
85 85
 			'WHERE `id` = ?';
86 86
         // If we want to check the owner, add it to the query
87 87
 		$params = [$credential_id];
88
-        if ($user_id !== null){
88
+        if ($user_id !== null) {
89 89
         	$sql .= ' and `user_id` = ? ';
90 90
 			array_push($params, $user_id);
91 91
 		}
92
-		return $this->findEntity($sql,$params);
92
+		return $this->findEntity($sql, $params);
93 93
 	}
94 94
 
95 95
 	/**
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param $credential_id
98 98
 	 * @return Credential
99 99
 	 */
100
-	public function getCredentialLabelById($credential_id){
100
+	public function getCredentialLabelById($credential_id) {
101 101
 		$sql = 'SELECT id, label FROM `*PREFIX*passman_credentials` ' .
102 102
 			'WHERE `id` = ? ';
103
-		return $this->findEntity($sql,[$credential_id]);
103
+		return $this->findEntity($sql, [$credential_id]);
104 104
 	}
105 105
 
106 106
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param $raw_credential
109 109
 	 * @return Credential
110 110
 	 */
111
-	public function create($raw_credential){
111
+	public function create($raw_credential) {
112 112
 		$credential = new Credential();
113 113
 
114 114
 		$credential->setGuid($this->utils->GUID());
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$credential->setCustomFields($raw_credential['custom_fields']);
132 132
 		$credential->setOtp($raw_credential['otp']);
133 133
 		$credential->setHidden($raw_credential['hidden']);
134
-		if(isset($raw_credential['shared_key'])) {
134
+		if (isset($raw_credential['shared_key'])) {
135 135
 			$credential->setSharedKey($raw_credential['shared_key']);
136 136
 		}
137 137
 		return parent::insert($credential);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param $raw_credential array An array containing all the credential fields
143 143
 	 * @return Credential The updated credential
144 144
 	 */
145
-	public function updateCredential($raw_credential){
145
+	public function updateCredential($raw_credential) {
146 146
 		$original = $this->getCredentialByGUID($raw_credential['guid']);
147 147
 		$credential = new Credential();
148 148
 		$credential->setId($original->getId());
@@ -166,17 +166,17 @@  discard block
 block discarded – undo
166 166
 		$credential->setOtp($raw_credential['otp']);
167 167
 		$credential->setHidden($raw_credential['hidden']);
168 168
 		$credential->setDeleteTime($raw_credential['delete_time']);
169
-		if(isset($raw_credential['shared_key'])) {
169
+		if (isset($raw_credential['shared_key'])) {
170 170
 			$credential->setSharedKey($raw_credential['shared_key']);
171 171
 		}
172 172
 		return parent::update($credential);
173 173
 	}
174 174
 
175
-	public function deleteCredential(Credential $credential){
175
+	public function deleteCredential(Credential $credential) {
176 176
 		return $this->delete($credential);
177 177
 	}
178 178
 
179
-	public function upd(Credential $credential){
179
+	public function upd(Credential $credential) {
180 180
 		$this->update($credential);
181 181
 	}
182 182
 
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
      * @param $credential_guid
186 186
      * @return Credential
187 187
      */
188
-	public function getCredentialByGUID($credential_guid, $user_id = null){
188
+	public function getCredentialByGUID($credential_guid, $user_id = null) {
189 189
 	    $q = 'SELECT * FROM `*PREFIX*passman_credentials` WHERE guid = ? ';
190 190
 		$params = [$credential_guid];
191
-		if ($user_id !== null){
191
+		if ($user_id !== null) {
192 192
 			$q .= ' and `user_id` = ? ';
193 193
 			array_push($params, $user_id);
194 194
 		}
Please login to merge, or discard this patch.
lib/Service/ShareService.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		ShareRequestMapper $shareRequest,
48 48
 		CredentialMapper $credentials,
49 49
 		CredentialRevisionService $revisions,
50
-	    EncryptService $encryptService
50
+		EncryptService $encryptService
51 51
 	) {
52 52
 		$this->sharingACL = $sharingACL;
53 53
 		$this->shareRequest = $shareRequest;
@@ -200,31 +200,31 @@  discard block
 block discarded – undo
200 200
 	}
201 201
 
202 202
 
203
-    /**
204
-     * Deletes a share request by the item ID
205
-     * @param ShareRequest $request
206
-     * @return \PDOStatement
207
-     */
203
+	/**
204
+	 * Deletes a share request by the item ID
205
+	 * @param ShareRequest $request
206
+	 * @return \PDOStatement
207
+	 */
208 208
 	public function cleanItemRequestsForUser(ShareRequest $request) {
209 209
 		return $this->shareRequest->cleanItemRequestsForUser($request->getItemId(), $request->getTargetUserId());
210 210
 	}
211 211
 
212
-    /**
213
-     * Get an share request by id
214
-     * @param $id
215
-     * @return ShareRequest
216
-     */
212
+	/**
213
+	 * Get an share request by id
214
+	 * @param $id
215
+	 * @return ShareRequest
216
+	 */
217 217
 	public function getShareRequestById($id) {
218 218
 		return $this->shareRequest->getShareRequestById($id);
219 219
 	}
220 220
 
221
-    /**
222
-     * Get an share request by $item_guid and $target_vault_guid
223
-     *
224
-     * @param $item_guid
225
-     * @param $target_vault_guid
226
-     * @return ShareRequest
227
-     */
221
+	/**
222
+	 * Get an share request by $item_guid and $target_vault_guid
223
+	 *
224
+	 * @param $item_guid
225
+	 * @param $target_vault_guid
226
+	 * @return ShareRequest
227
+	 */
228 228
 	public function getRequestByGuid($item_guid, $target_vault_guid) {
229 229
 		return $this->shareRequest->getRequestByItemAndVaultGuid($item_guid, $target_vault_guid);
230 230
 	}
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 		return $this->sharingACL->deleteShareACL($ACL);
285 285
 	}
286 286
 
287
-    /**
288
-     * Updates the given ACL entry
289
-     * @param SharingACL $sharingACL
290
-     * @return SharingACL
291
-     */
287
+	/**
288
+	 * Updates the given ACL entry
289
+	 * @param SharingACL $sharingACL
290
+	 * @return SharingACL
291
+	 */
292 292
 	public function updateCredentialACL(SharingACL $sharingACL) {
293 293
 		return $this->sharingACL->updateCredentialACL($sharingACL);
294 294
 	}
@@ -310,6 +310,6 @@  discard block
 block discarded – undo
310 310
 
311 311
 
312 312
 	public function updatePendingShareRequestsForCredential($item_guid, $user_id, $permissions){
313
-	    return $this->shareRequest->updatePendingRequestPermissions($item_guid, $user_id, $permissions);
314
-    }
313
+		return $this->shareRequest->updatePendingRequestPermissions($item_guid, $user_id, $permissions);
314
+	}
315 315
 }
316 316
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Service/CredentialRevisionService.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @param null $user_id
62 62
 	 * @return CredentialRevision[]
63 63
 	 */
64
-	public function getRevisions($credential_id, $user_id = null){
64
+	public function getRevisions($credential_id, $user_id = null) {
65 65
 		$result = $this->credentialRevisionMapper->getRevisions($credential_id, $user_id);
66
-		foreach ($result as $index => $revision){
66
+		foreach ($result as $index => $revision) {
67 67
 			$c = json_decode(base64_decode($revision->getCredentialData()), true);
68 68
 			$result[$index] = $revision->jsonSerialize();
69 69
 			$result[$index]['credential_data'] = $this->encryptService->decryptCredential($c);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param null $user_id
78 78
 	 * @return CredentialRevision
79 79
 	 */
80
-	public function getRevision($credential_id, $user_id = null){
80
+	public function getRevision($credential_id, $user_id = null) {
81 81
 		$revision = $this->credentialRevisionMapper->getRevision($credential_id, $user_id);
82 82
 		$c = json_decode(base64_decode($revision->getCredentialData()), true);
83 83
 		$revision->setCredentialData($this->encryptService->decryptCredential($c));
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param $user_id
91 91
 	 * @return CredentialRevision
92 92
 	 */
93
-	public function deleteRevision($revision_id, $user_id){
93
+	public function deleteRevision($revision_id, $user_id) {
94 94
 		return $this->credentialRevisionMapper->deleteRevision($revision_id, $user_id);
95 95
 	}
96 96
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param CredentialRevision $credentialRevision
100 100
 	 * @return CredentialRevision
101 101
 	 */
102
-	public function updateRevision(CredentialRevision $credentialRevision){
102
+	public function updateRevision(CredentialRevision $credentialRevision) {
103 103
 		$credential_data = $credentialRevision->getCredentialData();
104 104
 		$credential_data = json_decode(base64_decode($credential_data), true);
105 105
 		$credential_data = base64_encode(json_encode($this->encryptService->encryptCredential($credential_data)));
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 * @param null $user_id
62 62
 	 * @return CredentialRevision[]
63 63
 	 */
64
-	public function getRevisions($credential_id, $user_id = null){
64
+	public function getRevisions($credential_id, $user_id = null) {
65 65
 		$result = $this->credentialRevisionMapper->getRevisions($credential_id, $user_id);
66
-		foreach ($result as $index => $revision){
66
+		foreach ($result as $index => $revision) {
67 67
 			$c = json_decode(base64_decode($revision->getCredentialData()), true);
68 68
 			$result[$index] = $revision->jsonSerialize();
69 69
 			$result[$index]['credential_data'] = $this->encryptService->decryptCredential($c);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param null $user_id
78 78
 	 * @return CredentialRevision
79 79
 	 */
80
-	public function getRevision($credential_id, $user_id = null){
80
+	public function getRevision($credential_id, $user_id = null) {
81 81
 		$revision = $this->credentialRevisionMapper->getRevision($credential_id, $user_id);
82 82
 		$c = json_decode(base64_decode($revision->getCredentialData()), true);
83 83
 		$revision->setCredentialData($this->encryptService->decryptCredential($c));
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param $user_id
91 91
 	 * @return CredentialRevision
92 92
 	 */
93
-	public function deleteRevision($revision_id, $user_id){
93
+	public function deleteRevision($revision_id, $user_id) {
94 94
 		return $this->credentialRevisionMapper->deleteRevision($revision_id, $user_id);
95 95
 	}
96 96
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param CredentialRevision $credentialRevision
100 100
 	 * @return CredentialRevision
101 101
 	 */
102
-	public function updateRevision(CredentialRevision $credentialRevision){
102
+	public function updateRevision(CredentialRevision $credentialRevision) {
103 103
 		$credential_data = $credentialRevision->getCredentialData();
104 104
 		$credential_data = json_decode(base64_decode($credential_data), true);
105 105
 		$credential_data = base64_encode(json_encode($this->encryptService->encryptCredential($credential_data)));
Please login to merge, or discard this patch.