Completed
Pull Request — master (#518)
by Michael
03:07
created
code/backends/CapistranoDeploymentBackend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 
73 73
 			try {
74 74
 				$args['build_filename'] = $this->packageGenerator->getPackageFilename($project->Name, $sha, $repository, $log);
75
-			} catch (Exception $e) {
75
+			} catch(Exception $e) {
76 76
 				$log->write($e->getMessage());
77 77
 				throw $e;
78 78
 			}
Please login to merge, or discard this patch.
code/backends/DeploymentStrategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -130,10 +130,10 @@
 block discarded – undo
130 130
 	 */
131 131
 	public function getChangesModificationNeeded() {
132 132
 		$filtered = [];
133
-		foreach ($this->changes as $change => $details) {
134
-			if (array_key_exists('description', $details)) {
133
+		foreach($this->changes as $change => $details) {
134
+			if(array_key_exists('description', $details)) {
135 135
 				$filtered[$change] = $details;
136
-			} else if (
136
+			} else if(
137 137
 				(array_key_exists('from', $details) || array_key_exists('to', $details))
138 138
 				&& $details['from'] !== $details['to']
139 139
 			) {
Please login to merge, or discard this patch.
code/control/DeploynautLogFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 		// Make sure we write into the old path for existing logs. New logs use the sanitised file path instead.
78 78
 		$path = file_exists($this->getRawFilePath()) ? $this->getRawFilePath() : $this->getSanitisedLogFilePath();
79 79
 
80
-		error_log('['.date('Y-m-d H:i:s').'] ' . $message .PHP_EOL, 3, $path);
80
+		error_log('[' . date('Y-m-d H:i:s') . '] ' . $message . PHP_EOL, 3, $path);
81 81
 		@chmod($path, 0666);
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
code/control/Dispatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function asJSONValidatorErrors($code, $validatorErrors) {
65 65
 		$fieldErrors = [];
66
-		foreach ($validatorErrors as $error) {
66
+		foreach($validatorErrors as $error) {
67 67
 			$fieldErrors[$error['fieldName']] = $error['message'];
68 68
 		}
69 69
 		return $this->asJSONFormFieldErrors($code, $fieldErrors);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		// To get around that, upon spotting an active redirect, we change the response code to 200,
106 106
 		// and move the redirect into the "RedirectTo" field in the JSON response. Frontend can
107 107
 		// then interpret this and trigger a redirect.
108
-		if ($this->redirectedTo()) {
108
+		if($this->redirectedTo()) {
109 109
 			$data['RedirectTo'] = $this->response->getHeader('Location');
110 110
 			// Pop off the header - we are no longer redirecting via the usual mechanism.
111 111
 			$this->response->removeHeader('Location');
Please login to merge, or discard this patch.
code/extensions/FrontendLink.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 class FrontendLink extends DataExtension {
4 4
 
5 5
 	public function updateItemEditForm($form) {
6
-		if ($this->owner->record->hasMethod('Link')) {
6
+		if($this->owner->record->hasMethod('Link')) {
7 7
 			$link = sprintf(
8 8
 				'<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview &raquo;</a>',
9 9
 				$this->owner->record->Link()
Please login to merge, or discard this patch.
code/model/DNEnvironment.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 		}
386 386
 		// Must be logged in to check permissions
387 387
 
388
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
389
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
388
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
389
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
390 390
 		} else {
391
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
391
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
392 392
 		}
393 393
 
394 394
 		return $this->Deployers()->byID($member->ID)
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
 		}
412 412
 		// Must be logged in to check permissions
413 413
 
414
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
415
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
414
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
415
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
416 416
 		} else {
417
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
417
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
418 418
 		}
419 419
 
420 420
 		return $this->CanRestoreMembers()->byID($member->ID)
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
 			return false;
443 443
 		}
444 444
 
445
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
446
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
445
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
446
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
447 447
 		} else {
448
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
448
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
449 449
 		}
450 450
 
451 451
 		return $this->CanBackupMembers()->byID($member->ID)
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 		}
478 478
 		// Must be logged in to check permissions
479 479
 
480
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
481
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
480
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
481
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
482 482
 		} else {
483
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
483
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
484 484
 		}
485 485
 
486 486
 		return $this->ArchiveUploaders()->byID($member->ID)
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 		// Must be logged in to check permissions
505 505
 
506
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
507
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
506
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
507
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
508 508
 		} else {
509
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
509
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
510 510
 		}
511 511
 
512 512
 		return $this->ArchiveDownloaders()->byID($member->ID)
@@ -572,10 +572,10 @@  discard block
 block discarded – undo
572 572
 		}
573 573
 		// Must be logged in to check permissions
574 574
 
575
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
576
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
575
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
576
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
577 577
 		} else {
578
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
578
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
579 579
 		}
580 580
 
581 581
 		return $this->ArchiveDeleters()->byID($member->ID)
Please login to merge, or discard this patch.
code/model/DNProject.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return bool
263 263
 	 */
264 264
 	public function canRestore($member = null) {
265
-		if ($this->allowedAny(
265
+		if($this->allowedAny(
266 266
 			array(
267 267
 				DNRoot::ALLOW_PROD_SNAPSHOT,
268 268
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	public function canBackup($member = null) {
285
-		if ($this->allowedAny(
285
+		if($this->allowedAny(
286 286
 			array(
287 287
 				DNRoot::ALLOW_PROD_SNAPSHOT,
288 288
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return bool
303 303
 	 */
304 304
 	public function canUploadArchive($member = null) {
305
-		if ($this->allowedAny(
305
+		if($this->allowedAny(
306 306
 			array(
307 307
 				DNRoot::ALLOW_PROD_SNAPSHOT,
308 308
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool
323 323
 	 */
324 324
 	public function canDownloadArchive($member = null) {
325
-		if ($this->allowedAny(
325
+		if($this->allowedAny(
326 326
 			array(
327 327
 				DNRoot::ALLOW_PROD_SNAPSHOT,
328 328
 				DNRoot::ALLOW_NON_PROD_SNAPSHOT
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 	 * @return false|DNDeployment
499 499
 	 */
500 500
 	public function currentBuilds() {
501
-		if(!isset(self::$relation_cache['currentBuilds.'.$this->ID])) {
501
+		if(!isset(self::$relation_cache['currentBuilds.' . $this->ID])) {
502 502
 			$currentBuilds = array();
503 503
 			foreach($this->Environments() as $env) {
504 504
 				$currentBuilds[$env->Name] = $env->CurrentBuild();
505 505
 			}
506
-			self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds;
506
+			self::$relation_cache['currentBuilds.' . $this->ID] = $currentBuilds;
507 507
 		}
508
-		return self::$relation_cache['currentBuilds.'.$this->ID];
508
+		return self::$relation_cache['currentBuilds.' . $this->ID];
509 509
 	}
510 510
 
511 511
 	/**
@@ -987,14 +987,14 @@  discard block
 block discarded – undo
987 987
 	 * @return bool
988 988
 	 */
989 989
 	public function allowedAny($codes, $member = null) {
990
-		if (!$member) {
990
+		if(!$member) {
991 991
 			$member = Member::currentUser();
992 992
 		}
993 993
 
994 994
 		if(Permission::checkMember($member, 'ADMIN')) return true;
995 995
 
996 996
 		$hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count();
997
-		return ($hits>0 ? true : false);
997
+		return ($hits > 0 ? true : false);
998 998
 	}
999 999
 
1000 1000
 	/**
Please login to merge, or discard this patch.
code/model/jobs/DNDeployment.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function getFullDeployMessages() {
203 203
 		$strategy = $this->getDeploymentStrategy();
204
-		if ($strategy->getActionCode()!=='full') return null;
204
+		if($strategy->getActionCode() !== 'full') return null;
205 205
 
206 206
 		$changes = $strategy->getChangesModificationNeeded();
207 207
 		$messages = [];
208
-		foreach ($changes as $change => $details) {
209
-			if ($change==='Code version') continue;
208
+		foreach($changes as $change => $details) {
209
+			if($change === 'Code version') continue;
210 210
 
211 211
 			$messages[] = [
212 212
 				'Flag' => sprintf(
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			];
218 218
 		}
219 219
 
220
-		if (empty($messages)) {
220
+		if(empty($messages)) {
221 221
 			$messages[] = [
222 222
 				'Flag' => '',
223 223
 				'Text' => '<i>Environment changes have been made.</i>'
Please login to merge, or discard this patch.
code/model/steps/SmokeTestPipelineStep.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@
 block discarded – undo
127 127
 		curl_setopt($ch, CURLOPT_URL, $test['URL']);
128 128
 
129 129
 		// Allow individual tests to override number of attempts
130
-		$attempts = (int) $this->getConfigSetting('Attempts');
130
+		$attempts = (int)$this->getConfigSetting('Attempts');
131 131
 		if(!empty($test['Attempts'])) {
132 132
 			$attempts = $test['Attempts'];
133 133
 		}
Please login to merge, or discard this patch.