Completed
Push — master ( 417193...01c3ff )
by Mateusz
03:22
created
code/jobs/PingJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	 * Do the actual job by calling the appropiate backend
32 32
 	 */
33 33
 	public function perform() {
34
-		echo "[-] PingJob starting" . PHP_EOL;
34
+		echo "[-] PingJob starting".PHP_EOL;
35 35
 		$log = new DeploynautLogFile($this->args['logfile']);
36 36
 
37 37
 		$ping = DNPing::get()->byID($this->args['pingID']);
Please login to merge, or discard this patch.
code/jobs/CreateEnvJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 */
21 21
 	public function perform() {
22
-		echo "[-] CreateEnvJob starting" . PHP_EOL;
22
+		echo "[-] CreateEnvJob starting".PHP_EOL;
23 23
 		// This is a bit icky, but there is no easy way of capturing a failed deploy by using the PHP Resque
24 24
 		try {
25 25
 			$envCreate = DNCreateEnvironment::get()->byId($this->args['createID']);
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 			$envCreate->createEnvironment();
32 32
 
33 33
 		} catch(Exception $e) {
34
-			echo "[-] CreateEnvJob failed" . PHP_EOL;
34
+			echo "[-] CreateEnvJob failed".PHP_EOL;
35 35
 			throw $e;
36 36
 		}
37 37
 		$this->updateStatus('Finished');
38
-		echo "[-] CreateEnvJob finished" . PHP_EOL;
38
+		echo "[-] CreateEnvJob finished".PHP_EOL;
39 39
 	}
40 40
 
41 41
 	/**
Please login to merge, or discard this patch.
code/jobs/DataTransferJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	public function perform() {
23
-		echo "[-] DataTransferJob starting" . PHP_EOL;
23
+		echo "[-] DataTransferJob starting".PHP_EOL;
24 24
 		$log = new DeploynautLogFile($this->args['logfile']);
25 25
 		$dataTransfer = DNDataTransfer::get()->byID($this->args['dataTransferID']);
26 26
 		$environment = $dataTransfer->Environment();
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 		} catch(RuntimeException $exc) {
84 84
 			$log->write($exc->getMessage());
85 85
 
86
-			echo "[-] DataTransferJob failed" . PHP_EOL;
86
+			echo "[-] DataTransferJob failed".PHP_EOL;
87 87
 			throw $exc;
88 88
 		}
89 89
 
90 90
 		$this->updateStatus('Finished');
91
-		echo "[-] DataTransferJob finished" . PHP_EOL;
91
+		echo "[-] DataTransferJob finished".PHP_EOL;
92 92
 	}
93 93
 
94 94
 	/**
Please login to merge, or discard this patch.
code/model/DNData.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function setEnvironmentDir($environmentDir) {
91 91
 		if($environmentDir[0] != "/") {
92
-			$environmentDir = BASE_PATH . '/' . $environmentDir;
92
+			$environmentDir = BASE_PATH.'/'.$environmentDir;
93 93
 		}
94 94
 		$this->environmentDir = realpath($environmentDir) ?: $environmentDir;
95 95
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function setKeyDir($keyDir) {
112 112
 		if($keyDir[0] != "/") {
113
-			$keyDir = BASE_PATH . '/' . $keyDir;
113
+			$keyDir = BASE_PATH.'/'.$keyDir;
114 114
 		}
115 115
 		$this->keyDir = realpath($keyDir) ?: $keyDir;
116 116
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function setSignalDir($signalDir) {
129 129
 		if($signalDir[0] != "/") {
130
-			$signalDir = BASE_PATH . '/' . $signalDir;
130
+			$signalDir = BASE_PATH.'/'.$signalDir;
131 131
 		}
132 132
 		$this->signalDir = realpath($signalDir) ?: $signalDir;
133 133
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function setDataTransferDir($transferDir) {
171 171
 		if($transferDir[0] != "/") {
172
-			$transferDir = BASE_PATH . '/' . $transferDir;
172
+			$transferDir = BASE_PATH.'/'.$transferDir;
173 173
 		}
174 174
 		if(strpos($transferDir, ASSETS_PATH) === false) {
175 175
 			throw new LogicException(sprintf(
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 	public function getProjectPaths() {
200 200
 		$paths = array();
201 201
 		if(!file_exists($this->getEnvironmentDir())) {
202
-			$eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it '
202
+			$eMessage = 'The environment directory '.$this->getEnvironmentDir().' doesn\'t exist. Create it '
203 203
 			. 'first and add some projects to it.';
204 204
 			throw new Exception($eMessage);
205 205
 		}
206 206
 		foreach(scandir($this->getEnvironmentDir()) as $project) {
207 207
 			// Exlcude dot-prefixed directories (.git was getting in the way)
208 208
 			if(preg_match('/^[^\.]/', $project)) {
209
-				$path = $this->getEnvironmentDir() . '/' . $project;
209
+				$path = $this->getEnvironmentDir().'/'.$project;
210 210
 				if(is_dir($path) && $project != '.' && $project != '..') {
211 211
 					$paths[] = $project;
212 212
 				}
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 * Returns an array of paths
222 222
 	 */
223 223
 	public function getEnvironmentPaths($project) {
224
-		$baseDir = $this->getEnvironmentDir() . '/' . $project;
224
+		$baseDir = $this->getEnvironmentDir().'/'.$project;
225 225
 
226 226
 		$paths = array();
227 227
 		if(!file_exists($baseDir)) {
228
-			throw new Exception('Environment directory ' . $baseDir . ' doesn\'t exist. Create it first.');
228
+			throw new Exception('Environment directory '.$baseDir.' doesn\'t exist. Create it first.');
229 229
 		}
230 230
 		// Search the directory for config files.
231 231
 		foreach(scandir($baseDir) as $environmentFile) {
Please login to merge, or discard this patch.
code/control/DeployForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				substr($sha, 0, 8),
74 74
 				$branch->LastUpdated()->TimeDiff()
75 75
 			);
76
-			$branches[$sha . '-' . $name] = $branchValue;
76
+			$branches[$sha.'-'.$name] = $branchValue;
77 77
 		}
78 78
 
79 79
 		// Tags
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				substr($sha, 0, 8),
87 87
 				$branch->LastUpdated()->TimeDiff()
88 88
 			);
89
-			$tags[$sha . '-' . $tag] = $tagValue;
89
+			$tags[$sha.'-'.$tag] = $tagValue;
90 90
 		}
91 91
 		$tags = array_reverse($tags);
92 92
 
Please login to merge, or discard this patch.
code/model/DNEnvironment.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 		}
308 308
 		// Must be logged in to check permissions
309 309
 
310
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
311
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
310
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
311
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_DEPLOYMENT, $member)) return true;
312 312
 		} else {
313
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
313
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_DEPLOYMENT, $member)) return true;
314 314
 		}
315 315
 
316 316
 		return $this->Deployers()->byID($member->ID)
@@ -342,10 +342,10 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		// Must be logged in to check permissions
344 344
 
345
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
346
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
345
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
346
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
347 347
 		} else {
348
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
348
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
349 349
 		}
350 350
 
351 351
 		return $this->CanRestoreMembers()->byID($member->ID)
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 			return false;
374 374
 		}
375 375
 
376
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
377
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
376
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
377
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
378 378
 		} else {
379
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
379
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
380 380
 		}
381 381
 
382 382
 		return $this->CanBackupMembers()->byID($member->ID)
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 		}
409 409
 		// Must be logged in to check permissions
410 410
 
411
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
412
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
411
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
412
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
413 413
 		} else {
414
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
414
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
415 415
 		}
416 416
 
417 417
 		return $this->ArchiveUploaders()->byID($member->ID)
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 		}
435 435
 		// Must be logged in to check permissions
436 436
 
437
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
438
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
437
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
438
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
439 439
 		} else {
440
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
440
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
441 441
 		}
442 442
 
443 443
 		return $this->ArchiveDownloaders()->byID($member->ID)
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 		}
461 461
 		// Must be logged in to check permissions
462 462
 
463
-		if ($this->Usage==='Production' || $this->Usage==='Unspecified') {
464
-			if ($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
463
+		if($this->Usage === 'Production' || $this->Usage === 'Unspecified') {
464
+			if($this->Project()->allowed(DNRoot::ALLOW_PROD_SNAPSHOT, $member)) return true;
465 465
 		} else {
466
-			if ($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
466
+			if($this->Project()->allowed(DNRoot::ALLOW_NON_PROD_SNAPSHOT, $member)) return true;
467 467
 		}
468 468
 
469 469
 		return $this->ArchiveDeleters()->byID($member->ID)
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return string
654 654
 	 */
655 655
 	public function Link() {
656
-		return $this->Project()->Link() . "/environment/" . $this->Name;
656
+		return $this->Project()->Link()."/environment/".$this->Name;
657 657
 	}
658 658
 
659 659
 	/**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 				->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members)
799 799
 				->setTitle('Who can upload?')
800 800
 				->setDescription(
801
-					'Users who can upload archives linked to this environment into Deploynaut.<br />' .
801
+					'Users who can upload archives linked to this environment into Deploynaut.<br />'.
802 802
 					'Linking them to an environment allows limiting download permissions (see below).'
803 803
 				),
804 804
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		// Add actions
846 846
 		$action = new FormAction('check', 'Check Connection');
847 847
 		$action->setUseButtonTag(true);
848
-		$dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping';
848
+		$dataURL = Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping';
849 849
 		$action->setAttribute('data-url', $dataURL);
850 850
 		$fields->insertBefore($action, 'Name');
851 851
 
@@ -882,8 +882,8 @@  discard block
 block discarded – undo
882 882
 	 */
883 883
 	public function onBeforeWrite() {
884 884
 		parent::onBeforeWrite();
885
-		if($this->Name && $this->Name . '.rb' != $this->Filename) {
886
-			$this->Filename = $this->Name . '.rb';
885
+		if($this->Name && $this->Name.'.rb' != $this->Filename) {
886
+			$this->Filename = $this->Name.'.rb';
887 887
 		}
888 888
 		$this->checkEnvironmentPath();
889 889
 		$this->writeConfigFile();
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 			&& $this->Filename
931 931
 			&& $this->CreateEnvConfig
932 932
 		) {
933
-			$templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template';
933
+			$templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template';
934 934
 			file_put_contents($this->getConfigFilename(), file_get_contents($templateFile));
935 935
 		} else if($this->envFileExists() && $this->DeployConfig) {
936 936
 			file_put_contents($this->getConfigFilename(), $this->DeployConfig);
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 		if(!$this->Filename) {
986 986
 			return '';
987 987
 		}
988
-		return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename;
988
+		return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename;
989 989
 	}
990 990
 
991 991
 	/**
Please login to merge, or discard this patch.
code/control/DNRoot.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 		Requirements::javascript('deploynaut/javascript/material.js');
176 176
 
177 177
 		// Load the buildable dependencies only if not loaded centrally.
178
-		if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
179
-			if (\Director::isDev()) {
178
+		if(!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) {
179
+			if(\Director::isDev()) {
180 180
 				\Requirements::javascript('deploynaut/static/bundle-debug.js');
181 181
 			} else {
182 182
 				\Requirements::javascript('deploynaut/static/bundle.js');
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		}
240 240
 
241 241
 		// Block framework jquery
242
-		Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
242
+		Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
243 243
 
244 244
 		self::include_requirements();
245 245
 	}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @return \SS_HTTPResponse
259 259
 	 */
260 260
 	public function index(SS_HTTPRequest $request) {
261
-		return $this->redirect($this->Link() . 'projects/');
261
+		return $this->redirect($this->Link().'projects/');
262 262
 	}
263 263
 
264 264
 	/**
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		$form->disableSecurityToken();
419 419
 		$form->addExtraClass('fields-wide');
420 420
 		// Tweak the action so it plays well with our fake URL structure.
421
-		$form->setFormAction($project->Link() . '/UploadSnapshotForm');
421
+		$form->setFormAction($project->Link().'/UploadSnapshotForm');
422 422
 
423 423
 		return $form;
424 424
 	}
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		$dataArchive->DataTransfers()->add($dataTransfer);
469 469
 		$form->saveInto($dataArchive);
470 470
 		$dataArchive->write();
471
-		$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
471
+		$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
472 472
 
473 473
 		$cleanupFn = function() use($workingDir, $dataTransfer, $dataArchive) {
474 474
 			$process = new Process(sprintf('rm -rf %s', escapeshellarg($workingDir)));
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		$form->disableSecurityToken();
569 569
 		$form->addExtraClass('fields-wide');
570 570
 		// Tweak the action so it plays well with our fake URL structure.
571
-		$form->setFormAction($project->Link() . '/PostSnapshotForm');
571
+		$form->setFormAction($project->Link().'/PostSnapshotForm');
572 572
 
573 573
 		return $form;
574 574
 	}
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		$branchName = $request->getVar('name');
708 708
 		$branch = $project->DNBranchList()->byName($branchName);
709 709
 		if(!$branch) {
710
-			return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
710
+			return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404);
711 711
 		}
712 712
 
713 713
 		return $this->render(array(
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		);
844 844
 
845 845
 		// Tweak the action so it plays well with our fake URL structure.
846
-		$form->setFormAction($project->Link() . '/CreateEnvironmentForm');
846
+		$form->setFormAction($project->Link().'/CreateEnvironmentForm');
847 847
 
848 848
 		return $form;
849 849
 	}
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		$job->write();
877 877
 		$job->start();
878 878
 
879
-		return $this->redirect($project->Link('createenv') . '/' . $job->ID);
879
+		return $this->redirect($project->Link('createenv').'/'.$job->ID);
880 880
 	}
881 881
 
882 882
 	/**
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 	 */
938 938
 	public function getPlatformSpecificStrings() {
939 939
 		$strings = $this->config()->platform_specific_strings;
940
-		if ($strings) {
940
+		if($strings) {
941 941
 			return new ArrayList($strings);
942 942
 		}
943 943
 	}
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 
1003 1003
 				$isCurrentEnvironment = false;
1004 1004
 				if($project && $currentEnvironment) {
1005
-					$isCurrentEnvironment = (bool) $project->DNEnvironmentList()->find('ID', $currentEnvironment->ID);
1005
+					$isCurrentEnvironment = (bool)$project->DNEnvironmentList()->find('ID', $currentEnvironment->ID);
1006 1006
 				}
1007 1007
 
1008 1008
 				$navigation->push(array(
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 			return $body;
1073 1073
 		}
1074 1074
 
1075
-		$form->setFormAction($this->getRequest()->getURL() . '/DeployForm');
1075
+		$form->setFormAction($this->getRequest()->getURL().'/DeployForm');
1076 1076
 		return $form;
1077 1077
 	}
1078 1078
 
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
 	}
1229 1229
 
1230 1230
 	protected function applyRedeploy(SS_HTTPRequest $request, &$data) {
1231
-		if (!$request->getVar('redeploy')) return;
1231
+		if(!$request->getVar('redeploy')) return;
1232 1232
 
1233 1233
 		$project = $this->getCurrentProject();
1234 1234
 		if(!$project) {
@@ -1242,12 +1242,12 @@  discard block
 block discarded – undo
1242 1242
 		}
1243 1243
 
1244 1244
 		$current = $env->CurrentBuild();
1245
-		if ($current && $current->exists()) {
1245
+		if($current && $current->exists()) {
1246 1246
 			$data['preselect_tab'] = 3;
1247 1247
 			$data['preselect_sha'] = $current->SHA;
1248 1248
 		} else {
1249 1249
 			$master = $project->DNBranchList()->byName('master');
1250
-			if ($master) {
1250
+			if($master) {
1251 1251
 				$data['preselect_tab'] = 1;
1252 1252
 				$data['preselect_sha'] = $master->SHA();
1253 1253
 			}
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		$deployment->getMachine()->apply('queue');
1379 1379
 
1380 1380
 		return json_encode(array(
1381
-			'url' => Director::absoluteBaseURL() . $deployment->Link()
1381
+			'url' => Director::absoluteBaseURL().$deployment->Link()
1382 1382
 		), JSON_PRETTY_PRINT);
1383 1383
 	}
1384 1384
 
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 			throw new LogicException("Project in URL doesn't match this deploy");
1483 1483
 		}
1484 1484
 
1485
-		if (!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) {
1485
+		if(!in_array($deployment->Status, ['Queued', 'Deploying', 'Aborting'])) {
1486 1486
 			throw new LogicException(sprintf("Cannot abort from %s state.", $deployment->Status));
1487 1487
 		}
1488 1488
 
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 					->addExtraClass('btn')
1521 1521
 			)
1522 1522
 		);
1523
-		$form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm');
1523
+		$form->setFormAction($this->getRequest()->getURL().'/DataTransferForm');
1524 1524
 
1525 1525
 		return $form;
1526 1526
 	}
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 					->addExtraClass('btn')
1723 1723
 			)
1724 1724
 		);
1725
-		$form->setFormAction($project->Link() . '/DataTransferRestoreForm');
1725
+		$form->setFormAction($project->Link().'/DataTransferRestoreForm');
1726 1726
 
1727 1727
 		return $form;
1728 1728
 	}
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
 					->addExtraClass('btn')
1821 1821
 			)
1822 1822
 		);
1823
-		$form->setFormAction($project->Link() . '/DeleteForm');
1823
+		$form->setFormAction($project->Link().'/DeleteForm');
1824 1824
 
1825 1825
 		return $form;
1826 1826
 	}
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 					->addExtraClass('btn')
1927 1927
 			)
1928 1928
 		);
1929
-		$form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
1929
+		$form->setFormAction($this->getCurrentProject()->Link().'/MoveForm');
1930 1930
 
1931 1931
 		return $form;
1932 1932
 	}
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
 	 */
2220 2220
 	protected function project404Response() {
2221 2221
 		return new SS_HTTPResponse(
2222
-			"Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2222
+			"Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.",
2223 2223
 			404
2224 2224
 		);
2225 2225
 	}
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
 	 */
2230 2230
 	protected function environment404Response() {
2231 2231
 		$envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2232
-		return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2232
+		return new SS_HTTPResponse("Environment '".$envName."' not found.", 404);
2233 2233
 	}
2234 2234
 
2235 2235
 	/**
@@ -2296,7 +2296,7 @@  discard block
 block discarded – undo
2296 2296
 	public function AmbientMenu() {
2297 2297
 		$list = new ArrayList();
2298 2298
 
2299
-		if (Member::currentUserID()) {
2299
+		if(Member::currentUserID()) {
2300 2300
 			$list->push(new ArrayData(array(
2301 2301
 				'Classes' => 'logout',
2302 2302
 				'FaIcon' => 'sign-out',
Please login to merge, or discard this patch.
code/control/DNDeploymentDispatcher.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function getModel($name) {
21 21
 		$deployment = $this->getDeployment();
22
-		if (!$deployment) {
22
+		if(!$deployment) {
23 23
 			return [];
24 24
 		}
25 25
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	public function getDeployment() {
32 32
 		$id = $this->request->param('Id');
33 33
 		$deployment = DNDeployment::get()->byId($id);
34
-		if (!$deployment || !$deployment->exists()) {
34
+		if(!$deployment || !$deployment->exists()) {
35 35
 			return false;
36 36
 		}
37 37
 		return $deployment;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	public function apply(SS_HTTPRequest $request) {
41 41
 		$this->checkSecurityToken();
42 42
 		$response = $this->checkRequest();
43
-		if ($response instanceof SS_HTTPResponse) {
43
+		if($response instanceof SS_HTTPResponse) {
44 44
 			return $response;
45 45
 		}
46 46
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	public function canApply(SS_HTTPRequest $request) {
55 55
 		$this->checkSecurityToken();
56 56
 		$response = $this->checkRequest();
57
-		if ($response instanceof SS_HTTPResponse) {
57
+		if($response instanceof SS_HTTPResponse) {
58 58
 			return $response;
59 59
 		}
60 60
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		}
76 76
 
77 77
 		$deployment = $this->getDeployment();
78
-		if (!$deployment) {
78
+		if(!$deployment) {
79 79
 			return new SS_HTTPResponse('Deployment not found', 404);
80 80
 		}
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 	protected function getMachine() {
86 86
 		$deployment = $this->getDeployment();
87
-		if (!$deployment) {
87
+		if(!$deployment) {
88 88
 			return null;
89 89
 		}
90 90
 
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 			// It gives a chance to perform a dry-run, and reject the transition, for example
97 97
 			// in case the user is unauthorised.
98 98
 			'finite.test_transition',
99
-			function (Finite\Event\TransitionEvent $e) use ($project) {
99
+			function(Finite\Event\TransitionEvent $e) use ($project) {
100 100
 				$code = null;
101 101
 
102
-				switch ($e->getTransition()->getName()) {
102
+				switch($e->getTransition()->getName()) {
103 103
 				case 'approve':
104 104
 					$code = self::ALLOW_DNDEPLOYMENT_APPROVE;
105 105
 					break;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 					break;
109 109
 				}
110 110
 
111
-				if (!$code || !$project->allowed($code)) {
111
+				if(!$code || !$project->allowed($code)) {
112 112
 					$e->reject();
113 113
 				}
114 114
 			}
Please login to merge, or discard this patch.
code/model/StateMachineFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,17 +58,17 @@
 block discarded – undo
58 58
 
59 59
 	protected function addHandlers($machine) {
60 60
 		$class = get_class($machine->getObject());
61
-		if (empty($this->config()->handlers[$class])) return;
61
+		if(empty($this->config()->handlers[$class])) return;
62 62
 
63 63
 		$transitions = $this->config()->handlers[$class];
64
-		foreach ($transitions as $transName => $handlers) {
65
-			if (!is_array($handlers)) {
64
+		foreach($transitions as $transName => $handlers) {
65
+			if(!is_array($handlers)) {
66 66
 				throw new Exception(sprintf('Transition %s must be configured as an assoc array.', $transName));
67 67
 			}
68 68
 
69
-			foreach ($handlers as $handlerClass => $handlerMethod) {
69
+			foreach($handlers as $handlerClass => $handlerMethod) {
70 70
 				$handlerObj = Injector::inst()->get($handlerClass);
71
-				if (!is_callable([$handlerObj, $handlerMethod])) {
71
+				if(!is_callable([$handlerObj, $handlerMethod])) {
72 72
 					throw new Exception(sprintf('Handler %s is not callable on %s.', $handlerMethod, $handlerClass));
73 73
 				}
74 74
 				$machine->getDispatcher()->addListener(
Please login to merge, or discard this patch.