Failed Conditions
Pull Request — master (#721)
by Marcos
06:05
created
lib/Service/ActivityService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
 	 * @param $type string
49 49
 	 * @return array
50 50
 	 */
51
-	public function add($subject,$subjectParams=array(),
52
-						$message='',$messageParams=array(),
53
-						$link='',$user=null,$type='') {
54
-		if($user) {
51
+	public function add($subject, $subjectParams = array(),
52
+						$message = '', $messageParams = array(),
53
+						$link = '', $user = null, $type = '') {
54
+		if ($user) {
55 55
 			$activity = $this->manager->generateEvent();
56 56
 			$activity->setType($type);
57 57
 			$activity->setApp('passman');
Please login to merge, or discard this patch.
controller/credentialcontroller.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,13 +163,13 @@
 block discarded – undo
163 163
 				$activity . '_self', array($label, $this->userId, $revision_created),
164 164
 				'', array(),
165 165
 				$link, $this->userId, Activity::TYPE_ITEM_ACTION);
166
-		} else if (($storedCredential->getDeleteTime() === 0) && (int)$delete_time > 0) {
166
+		} else if (($storedCredential->getDeleteTime() === 0) && (int) $delete_time > 0) {
167 167
 			$activity = 'item_deleted';
168 168
 			$this->activityService->add(
169 169
 				$activity . '_self', array($label, $this->userId),
170 170
 				'', array(),
171 171
 				$link, $this->userId, Activity::TYPE_ITEM_ACTION);
172
-		} else if (($storedCredential->getDeleteTime() > 0) && (int)$delete_time === 0) {
172
+		} else if (($storedCredential->getDeleteTime() > 0) && (int) $delete_time === 0) {
173 173
 			$activity = 'item_recovered';
174 174
 			$this->activityService->add(
175 175
 				$activity . '_self', array($label, $this->userId),
Please login to merge, or discard this 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.
lib/Service/EncryptService.php 1 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.
middleware/sharemiddleware.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 			$setting = (in_array($methodName, $publicMethods)) ? 'link_sharing_enabled' : 'user_sharing_enabled';
27 27
 			$sharing_enabled = ($this->settings->isEnabled($setting));
28 28
 
29
-			if(in_array($methodName, $user_pub_methods)){
29
+			if (in_array($methodName, $user_pub_methods)) {
30 30
 				$sharing_enabled = ($this->settings->isEnabled('link_sharing_enabled') || $this->settings->isEnabled('user_sharing_enabled'));
31 31
 			}
32 32
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 			$setting = (in_array($methodName, $publicMethods)) ? 'link_sharing_enabled' : 'user_sharing_enabled';
27 27
 			$sharing_enabled = ($this->settings->isEnabled($setting));
28 28
 
29
-			if(in_array($methodName, $user_pub_methods)){
29
+			if(in_array($methodName, $user_pub_methods)) {
30 30
 				$sharing_enabled = ($this->settings->isEnabled('link_sharing_enabled') || $this->settings->isEnabled('user_sharing_enabled'));
31 31
 			}
32 32
 
Please login to merge, or discard this patch.
controller/vaultcontroller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 			foreach ($vaults as $vault) {
60 60
 				$credential = $this->credentialService->getRandomCredentialByVaultId($vault->getId(), $this->userId);
61 61
 				$secret_field = $protected_credential_fields[array_rand($protected_credential_fields)];
62
-				if(isset($credential)) {
62
+				if (isset($credential)) {
63 63
 					array_push($result, array(
64 64
 						'vault_id' => $vault->getId(),
65 65
 						'guid' => $vault->getGuid(),
Please login to merge, or discard this patch.
middleware/apimiddleware.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 	}
17 17
 
18 18
 	public function afterController($controller, $methodName, Response $response) {
19
-		if($response instanceof JSONResponse){
20
-			if(isset($this->request->server['HTTP_ORIGIN'])) {
19
+		if ($response instanceof JSONResponse) {
20
+			if (isset($this->request->server['HTTP_ORIGIN'])) {
21 21
 				$response->addHeader('Access-Control-Allow-Origin', $this->request->server['HTTP_ORIGIN']);
22 22
 			}
23 23
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 	}
17 17
 
18 18
 	public function afterController($controller, $methodName, Response $response) {
19
-		if($response instanceof JSONResponse){
19
+		if($response instanceof JSONResponse) {
20 20
 			if(isset($this->request->server['HTTP_ORIGIN'])) {
21 21
 				$response->addHeader('Access-Control-Allow-Origin', $this->request->server['HTTP_ORIGIN']);
22 22
 			}
Please login to merge, or discard this patch.
appinfo/routes.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,19 +52,19 @@
 block discarded – undo
52 52
 		//Sharing stuff
53 53
 		['name' => 'share#search', 'url' => '/api/v2/sharing/search', 'verb' => 'POST'],
54 54
 		['name' => 'share#getVaultsByUser', 'url' => '/api/v2/sharing/vaults/{user_id}', 'verb' => 'GET'],
55
-        ['name' => 'share#applyIntermediateShare', 'url' => '/api/v2/sharing/share', 'verb' => 'POST'],
56
-        ['name' => 'share#savePendingRequest', 'url' => '/api/v2/sharing/save', 'verb' => 'POST'],
57
-        ['name' => 'share#getPendingRequests', 'url' => '/api/v2/sharing/pending', 'verb' => 'GET'],
58
-        ['name' => 'share#deleteShareRequest', 'url' => '/api/v2/sharing/decline/{share_request_id}', 'verb' => 'DELETE'],
59
-        ['name' => 'share#getVaultItems', 'url' => '/api/v2/sharing/vault/{vault_guid}/get', 'verb' => 'GET'],
60
-        ['name' => 'share#createPublicShare', 'url' => '/api/v2/sharing/public', 'verb' => 'POST'],
61
-        ['name' => 'share#getPublicCredentialData', 'url' => '/api/v2/sharing/credential/{credential_guid}/public', 'verb' => 'GET'],
62
-        ['name' => 'share#unshareCredential', 'url' => '/api/v2/sharing/credential/{item_guid}', 'verb' => 'DELETE'],
63
-        ['name' => 'share#unshareCredentialFromUser', 'url' => '/api/v2/sharing/credential/{item_guid}/{user_id}', 'verb' => 'DELETE'],
64
-        ['name' => 'share#getRevisions', 'url' => '/api/v2/sharing/credential/{item_guid}/revisions', 'verb' => 'GET'],
65
-        ['name' => 'share#getItemAcl', 'url' => '/api/v2/sharing/credential/{item_guid}/acl', 'verb' => 'GET'],
66
-        ['name' => 'share#getFile', 'url' => '/api/v2/sharing/credential/{item_guid}/file/{file_guid}', 'verb' => 'GET'],
67
-        ['name' => 'share#updateSharedCredentialACL', 'url' => '/api/v2/sharing/credential/{item_guid}/acl', 'verb' => 'PATCH'],
55
+		['name' => 'share#applyIntermediateShare', 'url' => '/api/v2/sharing/share', 'verb' => 'POST'],
56
+		['name' => 'share#savePendingRequest', 'url' => '/api/v2/sharing/save', 'verb' => 'POST'],
57
+		['name' => 'share#getPendingRequests', 'url' => '/api/v2/sharing/pending', 'verb' => 'GET'],
58
+		['name' => 'share#deleteShareRequest', 'url' => '/api/v2/sharing/decline/{share_request_id}', 'verb' => 'DELETE'],
59
+		['name' => 'share#getVaultItems', 'url' => '/api/v2/sharing/vault/{vault_guid}/get', 'verb' => 'GET'],
60
+		['name' => 'share#createPublicShare', 'url' => '/api/v2/sharing/public', 'verb' => 'POST'],
61
+		['name' => 'share#getPublicCredentialData', 'url' => '/api/v2/sharing/credential/{credential_guid}/public', 'verb' => 'GET'],
62
+		['name' => 'share#unshareCredential', 'url' => '/api/v2/sharing/credential/{item_guid}', 'verb' => 'DELETE'],
63
+		['name' => 'share#unshareCredentialFromUser', 'url' => '/api/v2/sharing/credential/{item_guid}/{user_id}', 'verb' => 'DELETE'],
64
+		['name' => 'share#getRevisions', 'url' => '/api/v2/sharing/credential/{item_guid}/revisions', 'verb' => 'GET'],
65
+		['name' => 'share#getItemAcl', 'url' => '/api/v2/sharing/credential/{item_guid}/acl', 'verb' => 'GET'],
66
+		['name' => 'share#getFile', 'url' => '/api/v2/sharing/credential/{item_guid}/file/{file_guid}', 'verb' => 'GET'],
67
+		['name' => 'share#updateSharedCredentialACL', 'url' => '/api/v2/sharing/credential/{item_guid}/acl', 'verb' => 'PATCH'],
68 68
 		['name' => 'internal#getAppVersion', 'url' => '/api/v2/version', 'verb' => 'GET'],
69 69
 
70 70
 		//Settings
Please login to merge, or discard this patch.
controller/filecontroller.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	public function __construct($AppName,
24 24
 								IRequest $request,
25 25
 								$UserId,
26
-								FileService $fileService){
26
+								FileService $fileService) {
27 27
 		parent::__construct(
28 28
 			$AppName,
29 29
 			$request,
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 		return new JSONResponse($this->fileService->deleteFile($file_id, $this->userId));
66 66
 	}
67 67
 
68
-	public function updateFile($file_id, $file_data, $filename){
69
-		try{
68
+	public function updateFile($file_id, $file_data, $filename) {
69
+		try {
70 70
 			$file = $this->fileService->getFile($file_id, $this->userId);
71
-		} catch (\Exception $doesNotExistException){
71
+		} catch (\Exception $doesNotExistException) {
72 72
 
73 73
 		}
74
-		if($file){
75
-			if($file_data) {
74
+		if ($file) {
75
+			if ($file_data) {
76 76
 				$file->setFileData($file_data);
77 77
 			}
78
-			if($filename) {
78
+			if ($filename) {
79 79
 				$file->setFilename($filename);
80 80
 			}
81
-			if($filename || $file_data){
81
+			if ($filename || $file_data) {
82 82
 				new JSONResponse($this->fileService->updateFile($file));
83 83
 			}
84 84
 		}
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	public function __construct($AppName,
24 24
 								IRequest $request,
25 25
 								$UserId,
26
-								FileService $fileService){
26
+								FileService $fileService) {
27 27
 		parent::__construct(
28 28
 			$AppName,
29 29
 			$request,
@@ -65,20 +65,20 @@  discard block
 block discarded – undo
65 65
 		return new JSONResponse($this->fileService->deleteFile($file_id, $this->userId));
66 66
 	}
67 67
 
68
-	public function updateFile($file_id, $file_data, $filename){
68
+	public function updateFile($file_id, $file_data, $filename) {
69 69
 		try{
70 70
 			$file = $this->fileService->getFile($file_id, $this->userId);
71 71
 		} catch (\Exception $doesNotExistException){
72 72
 
73 73
 		}
74
-		if($file){
74
+		if($file) {
75 75
 			if($file_data) {
76 76
 				$file->setFileData($file_data);
77 77
 			}
78 78
 			if($filename) {
79 79
 				$file->setFilename($filename);
80 80
 			}
81
-			if($filename || $file_data){
81
+			if($filename || $file_data) {
82 82
 				new JSONResponse($this->fileService->updateFile($file));
83 83
 			}
84 84
 		}
Please login to merge, or discard this patch.
lib/Db/DeleteVaultRequest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
  */
39 39
 
40 40
 
41
-class DeleteVaultRequest extends Entity implements  \JsonSerializable{
41
+class DeleteVaultRequest extends Entity implements  \JsonSerializable {
42 42
 
43 43
 	use EntityJSONSerializer;
44 44
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
  */
39 39
 
40 40
 
41
-class DeleteVaultRequest extends Entity implements  \JsonSerializable{
41
+class DeleteVaultRequest extends Entity implements  \JsonSerializable {
42 42
 
43 43
 	use EntityJSONSerializer;
44 44
 
Please login to merge, or discard this patch.