Completed
Push — master ( 946999...5f7661 )
by Marcos
04:12
created
lib/Service/ShareService.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,7 +71,9 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	public function createACLEntry(SharingACL $acl) {
74
-		if ($acl->getCreated() === null) $acl->setCreated((new \DateTime())->getTimestamp());
74
+		if ($acl->getCreated() === null) {
75
+			$acl->setCreated((new \DateTime())->getTimestamp());
76
+		}
75 77
 		return $this->sharingACL->createACLEntry($acl);
76 78
 	}
77 79
 
@@ -124,12 +126,16 @@  discard block
 block discarded – undo
124 126
 		$return = [];
125 127
 		foreach ($entries as $entry) {
126 128
 			// Check if the user can read the credential, probably unnecesary, but just to be sure
127
-			if (!$entry->hasPermission(SharingACL::READ)) continue;
129
+			if (!$entry->hasPermission(SharingACL::READ)) {
130
+				continue;
131
+			}
128 132
 
129 133
 			$tmp = $entry->jsonSerialize();
130 134
 			$tmp['credential_data'] = $this->credential->getCredentialById($entry->getItemId())->jsonSerialize();
131 135
 
132
-			if (!$entry->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);
136
+			if (!$entry->hasPermission(SharingACL::FILES)) {
137
+				unset($tmp['credential_data']['files']);
138
+			}
133 139
 			unset($tmp['credential_data']['shared_key']);
134 140
 			$return[] = $tmp;
135 141
 		}
@@ -150,12 +156,16 @@  discard block
 block discarded – undo
150 156
 		$acl = $this->sharingACL->getItemACL($user_id, $item_guid);
151 157
 
152 158
 		// Check if the user can read the credential, probably unnecesary, but just to be sure
153
-		if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level");
159
+		if (!$acl->hasPermission(SharingACL::READ)) {
160
+			throw new DoesNotExistException("Item not found or wrong access level");
161
+		}
154 162
 
155 163
 		$tmp = $acl->jsonSerialize();
156 164
 		$tmp['credential_data'] = $this->credential->getCredentialById($acl->getItemId())->jsonSerialize();
157 165
 
158
-		if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);
166
+		if (!$acl->hasPermission(SharingACL::FILES)) {
167
+			unset($tmp['credential_data']['files']);
168
+		}
159 169
 		unset($tmp['credential_data']['shared_key']);
160 170
 
161 171
 		return $tmp;
@@ -170,7 +180,9 @@  discard block
 block discarded – undo
170 180
 	 */
171 181
 	public function getItemHistory($user_id, $item_guid) {
172 182
 		$acl = $this->sharingACL->getItemACL($user_id, $item_guid);
173
-		if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) return [];
183
+		if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) {
184
+			return [];
185
+		}
174 186
 
175 187
 		return $this->revisions->getRevisions($acl->getItemId());
176 188
 	}
Please login to merge, or discard this patch.
lib/Service/EncryptService.php 2 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.
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.
migration/serversideencryption.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
 		}
84 84
 	}
85 85
 
86
-	private function fetchAll($sql){
86
+	private function fetchAll($sql) {
87 87
 		return $this->db->executeQuery($sql)->fetchAll();
88 88
 	}
89 89
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
 		}
84 84
 	}
85 85
 
86
-	private function fetchAll($sql){
86
+	private function fetchAll($sql) {
87 87
 		return $this->db->executeQuery($sql)->fetchAll();
88 88
 	}
89 89
 
Please login to merge, or discard this patch.
controller/credentialcontroller.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 				$activity . '_self', array($label, $this->userId, $revision_created),
168 168
 				'', array(),
169 169
 				$link, $this->userId, Activity::TYPE_ITEM_ACTION);
170
-		} else if (($storedCredential->getDeleteTime() === 0) && (int)$delete_time > 0) {
170
+		} else if (($storedCredential->getDeleteTime() === 0) && (int) $delete_time > 0) {
171 171
 			$activity = 'item_deleted';
172 172
 			$this->activityService->add(
173 173
 				$activity . '_self', array($label, $this->userId),
174 174
 				'', array(),
175 175
 				$link, $this->userId, Activity::TYPE_ITEM_ACTION);
176
-		} else if (($storedCredential->getDeleteTime() > 0) && (int)$delete_time === 0) {
176
+		} else if (($storedCredential->getDeleteTime() > 0) && (int) $delete_time === 0) {
177 177
 			$activity = 'item_recovered';
178 178
 			$this->activityService->add(
179 179
 				$activity . '_self', array($label, $this->userId),
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			$credential['shared_key'] = '';
242 242
 		}
243 243
 
244
-		if(!isset($credential['shared_key'])){
244
+		if (!isset($credential['shared_key'])) {
245 245
 			$credential['shared_key'] = $storedCredential->getSharedKey();
246 246
 		}
247 247
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@
 block discarded – undo
241 241
 			$credential['shared_key'] = '';
242 242
 		}
243 243
 
244
-		if(!isset($credential['shared_key'])){
244
+		if(!isset($credential['shared_key'])) {
245 245
 			$credential['shared_key'] = $storedCredential->getSharedKey();
246 246
 		}
247 247
 
Please login to merge, or discard this patch.
lib/Service/SettingsService.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * Check if an setting is enabled (value of 1)
112 112
 	 *
113
-	 * @param $setting
113
+	 * @param string $setting
114 114
 	 * @return bool
115 115
 	 */
116 116
 	public function isEnabled($setting) {
Please login to merge, or discard this patch.