Failed Conditions
Pull Request — master (#682)
by
unknown
16:09 queued 06:03
created
controller/internalcontroller.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
 	private $appManager;
28 28
 
29 29
 	public function __construct($AppName,
30
-	                            IRequest $request,
31
-	                            $UserId,
32
-	                            CredentialService $credentialService,
33
-	                            IConfig $config,
34
-	                            IManager $IManager,
35
-	                            IAppManager $appManager
30
+								IRequest $request,
31
+								$UserId,
32
+								CredentialService $credentialService,
33
+								IConfig $config,
34
+								IManager $IManager,
35
+								IAppManager $appManager
36 36
 	) {
37 37
 		parent::__construct(
38 38
 			$AppName,
Please login to merge, or discard this patch.
migration/serversideencryption.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 	private $fileService;
61 61
 
62 62
 	public function __construct(EncryptService $encryptService, IDBConnection $db, LoggerInterface $logger, CredentialService $credentialService, CredentialRevisionService $revisionService,
63
-	                            FileService $fileService, IConfig $config) {
63
+								FileService $fileService, IConfig $config) {
64 64
 		$this->encryptService = $encryptService;
65 65
 		$this->db = $db;
66 66
 		$this->logger = $logger;
Please login to merge, or discard this patch.
lib/Service/ShareService.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,7 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @return Entity
102 102
 	 */
103 103
 	public function createACLEntry(SharingACL $acl) {
104
-		if ($acl->getCreated() === null) $acl->setCreated((new \DateTime())->getTimestamp());
104
+		if ($acl->getCreated() === null) {
105
+			$acl->setCreated((new \DateTime())->getTimestamp());
106
+		}
105 107
 		return $this->sharingACL->createACLEntry($acl);
106 108
 	}
107 109
 
@@ -159,13 +161,17 @@  discard block
 block discarded – undo
159 161
 		$return = [];
160 162
 		foreach ($entries as $entry) {
161 163
 			// Check if the user can read the credential, probably unnecesary, but just to be sure
162
-			if (!$entry->hasPermission(SharingACL::READ)) continue;
164
+			if (!$entry->hasPermission(SharingACL::READ)) {
165
+				continue;
166
+			}
163 167
 			$tmp = $entry->jsonSerialize();
164 168
 			$credential = $this->credential->getCredentialById($entry->getItemId());
165 169
 			$credential = $this->encryptService->decryptCredential($credential);
166 170
 			$tmp['credential_data'] = $credential->jsonSerialize();
167 171
 
168
-			if (!$entry->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);
172
+			if (!$entry->hasPermission(SharingACL::FILES)) {
173
+				unset($tmp['credential_data']['files']);
174
+			}
169 175
 			unset($tmp['credential_data']['shared_key']);
170 176
 			$return[] = $tmp;
171 177
 		}
@@ -194,7 +200,9 @@  discard block
 block discarded – undo
194 200
 		$acl = $this->sharingACL->getItemACL($user_id, $item_guid);
195 201
 
196 202
 		// Check if the user can read the credential, probably unnecesary, but just to be sure
197
-		if (!$acl->hasPermission(SharingACL::READ)) throw new DoesNotExistException("Item not found or wrong access level");
203
+		if (!$acl->hasPermission(SharingACL::READ)) {
204
+			throw new DoesNotExistException("Item not found or wrong access level");
205
+		}
198 206
 
199 207
 		$tmp = $acl->jsonSerialize();
200 208
 		$credential = $this->credential->getCredentialById($acl->getItemId());
@@ -202,7 +210,9 @@  discard block
 block discarded – undo
202 210
 
203 211
 		$tmp['credential_data'] = $credential->jsonSerialize();
204 212
 
205
-		if (!$acl->hasPermission(SharingACL::FILES)) unset($tmp['credential_data']['files']);
213
+		if (!$acl->hasPermission(SharingACL::FILES)) {
214
+			unset($tmp['credential_data']['files']);
215
+		}
206 216
 		unset($tmp['credential_data']['shared_key']);
207 217
 
208 218
 		return $tmp;
@@ -217,7 +227,9 @@  discard block
 block discarded – undo
217 227
 	 */
218 228
 	public function getItemHistory(string $user_id, string $item_guid) {
219 229
 		$acl = $this->sharingACL->getItemACL($user_id, $item_guid);
220
-		if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) return [];
230
+		if (!$acl->hasPermission(SharingACL::READ | SharingACL::HISTORY)) {
231
+			return [];
232
+		}
221 233
 
222 234
 		return $this->revisions->getRevisions($acl->getItemId());
223 235
 	}
Please login to merge, or discard this patch.
lib/Utility/Utils.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 use OCP\IUserManager;
27 27
 
28 28
 class Utils {
29
-    /**
30
-     * Gets the unix epoch UTC timestamp
31
-     * @return int
32
-     */
29
+	/**
30
+	 * Gets the unix epoch UTC timestamp
31
+	 * @return int
32
+	 */
33 33
 	public static function getTime() {
34 34
 		return (new \DateTime())->getTimestamp();
35 35
 	}
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		return microtime(true);
41 41
 	}
42 42
 
43
-    /**
44
-     * Generates a Globally Unique ID
45
-     * @return string
46
-     */
43
+	/**
44
+	 * Generates a Globally Unique ID
45
+	 * @return string
46
+	 */
47 47
 	public static function GUID() {
48 48
 		if (function_exists('com_create_guid') === true)
49 49
 		{
Please login to merge, or discard this patch.
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@  discard block
 block discarded – undo
45 45
      * @return string
46 46
      */
47 47
 	public static function GUID() {
48
-		if (function_exists('com_create_guid') === true)
49
-		{
48
+		if (function_exists('com_create_guid') === true) {
50 49
 			return trim(com_create_guid(), '{}');
51 50
 		}
52 51
 
@@ -58,7 +57,7 @@  discard block
 block discarded – undo
58 57
 	 * @param IUserManager $userManager
59 58
 	 * @return string
60 59
 	 */
61
-	public static function getNameByUid(string $uid, IUserManager $userManager){
60
+	public static function getNameByUid(string $uid, IUserManager $userManager) {
62 61
 		$u = $userManager->get($uid);
63 62
 		return $u->getDisplayName();
64 63
 	}
@@ -68,10 +67,10 @@  discard block
 block discarded – undo
68 67
 	 * @param array $results
69 68
 	 * @return array|mixed
70 69
 	 */
71
-	public static function getDirContents(string $dir, &$results = array()){
70
+	public static function getDirContents(string $dir, &$results = array()) {
72 71
 		$files = scandir($dir);
73 72
 
74
-		foreach($files as $value){
73
+		foreach($files as $value) {
75 74
 			$path = realpath($dir.DIRECTORY_SEPARATOR.$value);
76 75
 			if(!is_dir($path)) {
77 76
 				$results[] = $path;
Please login to merge, or discard this patch.
controller/sharecontroller.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,18 +51,18 @@
 block discarded – undo
51 51
 	private $offset = 0;
52 52
 
53 53
 	public function __construct($AppName,
54
-	                            IRequest $request,
55
-	                            $UserId,
56
-	                            IGroupManager $groupManager,
57
-	                            IUserManager $userManager,
58
-	                            ActivityService $activityService,
59
-	                            VaultService $vaultService,
60
-	                            ShareService $shareService,
61
-	                            CredentialService $credentialService,
62
-	                            NotificationService $notificationService,
63
-	                            FileService $fileService,
64
-	                            SettingsService $config,
65
-	                            IManager $IManager
54
+								IRequest $request,
55
+								$UserId,
56
+								IGroupManager $groupManager,
57
+								IUserManager $userManager,
58
+								ActivityService $activityService,
59
+								VaultService $vaultService,
60
+								ShareService $shareService,
61
+								CredentialService $credentialService,
62
+								NotificationService $notificationService,
63
+								FileService $fileService,
64
+								SettingsService $config,
65
+								IManager $IManager
66 66
 	) {
67 67
 		parent::__construct(
68 68
 			$AppName,
Please login to merge, or discard this patch.
controller/credentialcontroller.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	private $settings;
37 37
 
38 38
 	public function __construct($AppName,
39
-	                            IRequest $request,
40
-	                            $userId,
41
-	                            CredentialService $credentialService,
42
-	                            ActivityService $activityService,
43
-	                            CredentialRevisionService $credentialRevisionService,
44
-	                            ShareService $sharingService,
45
-	                            SettingsService $settings
39
+								IRequest $request,
40
+								$userId,
41
+								CredentialService $credentialService,
42
+								ActivityService $activityService,
43
+								CredentialRevisionService $credentialRevisionService,
44
+								ShareService $sharingService,
45
+								SettingsService $settings
46 46
 
47 47
 	) {
48 48
 		parent::__construct(
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @NoCSRFRequired
66 66
 	 */
67 67
 	public function createCredential($changed, $created,
68
-	                                 $credential_id, $custom_fields, $delete_time,
69
-	                                 $description, $email, $expire_time, $favicon, $files, $guid,
70
-	                                 $hidden, $icon, $label, $otp, $password, $renew_interval,
71
-	                                 $tags, $url, $username, $vault_id, $compromised) {
68
+									 $credential_id, $custom_fields, $delete_time,
69
+									 $description, $email, $expire_time, $favicon, $files, $guid,
70
+									 $hidden, $icon, $label, $otp, $password, $renew_interval,
71
+									 $tags, $url, $username, $vault_id, $compromised) {
72 72
 		$credential = array(
73 73
 			'credential_id' => $credential_id,
74 74
 			'guid' => $guid,
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
 	 * @NoCSRFRequired
122 122
 	 */
123 123
 	public function updateCredential($changed, $created,
124
-	                                 $credential_id, $custom_fields, $delete_time, $credential_guid,
125
-	                                 $description, $email, $expire_time, $icon, $files, $guid,
126
-	                                 $hidden, $label, $otp, $password, $renew_interval,
127
-	                                 $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision, $compromised) {
124
+									 $credential_id, $custom_fields, $delete_time, $credential_guid,
125
+									 $description, $email, $expire_time, $icon, $files, $guid,
126
+									 $hidden, $label, $otp, $password, $renew_interval,
127
+									 $tags, $url, $username, $vault_id, $revision_created, $shared_key, $acl, $unshare_action, $set_share_key, $skip_revision, $compromised) {
128 128
 
129 129
 
130 130
 		$storedCredential = $this->credentialService->getCredentialByGUID($credential_guid);
Please login to merge, or discard this patch.
controller/iconcontroller.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 	private $urlGenerator;
31 31
 
32 32
 	public function __construct($AppName,
33
-	                            IRequest $request,
34
-	                            $UserId,
35
-	                            CredentialService $credentialService,
36
-	                            AppManager $am,
37
-	                            IURLGenerator $urlGenerator
33
+								IRequest $request,
34
+								$UserId,
35
+								CredentialService $credentialService,
36
+								AppManager $am,
37
+								IURLGenerator $urlGenerator
38 38
 	) {
39 39
 		parent::__construct(
40 40
 			$AppName,
Please login to merge, or discard this patch.
controller/admincontroller.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,7 +129,7 @@  discard block
 block discarded – undo
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 134
 		try{
135 135
 			$vault = $this->vaultService->getByGuid($vault_guid, $requested_by);
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
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
 			}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
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);
Please login to merge, or discard this patch.