Completed
Pull Request — master (#160)
by Sander
05:12
created
lib/Service/ShareService.php 2 patches
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.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -281,7 +281,6 @@  discard block
 block discarded – undo
281 281
 	/**
282 282
 	 * Delete ACL
283 283
 	 *
284
-	 * @param  ShareRequest $request
285 284
 	 * @return \OCA\Passman\Db\ShareRequest[]
286 285
 	 */
287 286
 	public function deleteShareACL(SharingACL $ACL) {
@@ -306,7 +305,6 @@  discard block
 block discarded – undo
306 305
 	/**
307 306
 	 * Get pending share requests by guid and uid
308 307
 	 *
309
-	 * @param  ShareRequest $request
310 308
 	 * @return \OCA\Passman\Db\ShareRequest[]
311 309
 	 */
312 310
 	public function getPendingShareRequestsForCredential($item_guid, $user_id) {
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.
lib/Service/EncryptService.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function __construct(SettingsService $settings) {
98 98
 		$this->cipher = $settings->getAppSetting('server_side_encryption');
99
-		$this->rounds = (int)100;
99
+		$this->rounds = (int) 100;
100 100
 		$this->server_key = \OC::$server->getConfig()->getSystemValue('passwordsalt', '');
101 101
 	}
102 102
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 
297 297
 
298
-	private function extractKeysFromCredential($credential){
298
+	private function extractKeysFromCredential($credential) {
299 299
 		$userKey = '';
300 300
 		$userSuppliedKey = '';
301 301
 		if ($credential instanceof Credential) {
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -264,7 +264,9 @@  discard block
 block discarded – undo
264 264
 	protected function unpad($data) {
265 265
 		$length = $this->getKeySize();
266 266
 		$last = ord($data[strlen($data) - 1]);
267
-		if ($last > $length) return false;
267
+		if ($last > $length) {
268
+			return false;
269
+		}
268 270
 		if (substr($data, -1 * $last) !== str_repeat(chr($last), $last)) {
269 271
 			return false;
270 272
 		}
@@ -295,7 +297,7 @@  discard block
 block discarded – undo
295 297
 
296 298
 
297 299
 
298
-	private function extractKeysFromCredential($credential){
300
+	private function extractKeysFromCredential($credential) {
299 301
 		$userKey = '';
300 302
 		$userSuppliedKey = '';
301 303
 		if ($credential instanceof Credential) {
Please login to merge, or discard this patch.