Completed
Pull Request — master (#658)
by Stig
10:45 queued 04:00
created
code/backends/DeploymentStrategy.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -75,6 +75,7 @@  discard block
 block discarded – undo
75 75
 	}
76 76
 
77 77
 	/**
78
+	 * @param string $code
78 79
 	 */
79 80
 	public function setActionCode($code) {
80 81
 		$this->actionCode = $code;
@@ -89,6 +90,7 @@  discard block
 block discarded – undo
89 90
 
90 91
 	/**
91 92
 	 * @param int
93
+	 * @param string $seconds
92 94
 	 */
93 95
 	public function setEstimatedTime($seconds) {
94 96
 		$this->estimatedTime = $seconds;
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,8 +110,12 @@
 block discarded – undo
110 110
 		// Normalise "empty" values into dashes so comparisons are done properly.
111 111
 		// This means there is no diference between an empty string and a null
112 112
 		// but "0" is considered to be non-empty.
113
-		if(empty($from) && !strlen($from)) $from = '-';
114
-		if(empty($to) && !strlen($to)) $to = '-';
113
+		if(empty($from) && !strlen($from)) {
114
+			$from = '-';
115
+		}
116
+		if(empty($to) && !strlen($to)) {
117
+			$to = '-';
118
+		}
115 119
 
116 120
 		return $this->changes[$title] = array(
117 121
 			'from' => $from,
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		// Normalise "empty" values into dashes so comparisons are done properly.
111 111
 		// This means there is no diference between an empty string and a null
112 112
 		// but "0" is considered to be non-empty.
113
-		if(empty($from) && !strlen($from)) $from = '-';
114
-		if(empty($to) && !strlen($to)) $to = '-';
113
+		if (empty($from) && !strlen($from)) $from = '-';
114
+		if (empty($to) && !strlen($to)) $to = '-';
115 115
 
116 116
 		return $this->changes[$title] = array(
117 117
 			'from' => $from,
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function getChange($key) {
172 172
 		$changes = $this->getChanges();
173
-		if(array_key_exists($key, $changes)) {
173
+		if (array_key_exists($key, $changes)) {
174 174
 			return new ArrayData($changes[$key]);
175 175
 		}
176 176
 		return null;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @return string|null
190 190
 	 */
191 191
 	public function getOption($option) {
192
-		if(!empty($this->options[$option])) {
192
+		if (!empty($this->options[$option])) {
193 193
 			return $this->options[$option];
194 194
 		}
195 195
 	}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 			DeploymentStrategy::WARNING_CODE => 1,
231 231
 			DeploymentStrategy::ERROR_CODE => 2
232 232
 		];
233
-		if($map[$current] < $map[$code]) {
233
+		if ($map[$current] < $map[$code]) {
234 234
 			$this->setValidationCode($code);
235 235
 		}
236 236
 	}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		);
260 260
 
261 261
 		$output = array();
262
-		foreach($fields as $field) {
262
+		foreach ($fields as $field) {
263 263
 			$output[$field] = $this->$field;
264 264
 		}
265 265
 		return $output;
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
 			'messages'
301 301
 		);
302 302
 
303
-		foreach($fields as $field) {
304
-			if(!empty($data[$field])) {
303
+		foreach ($fields as $field) {
304
+			if (!empty($data[$field])) {
305 305
 				$this->$field = $data[$field];
306 306
 			}
307 307
 		}
Please login to merge, or discard this patch.
code/model/DNEnvironment.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -954,7 +954,7 @@
 block discarded – undo
954 954
 to other environments, alongside the "Who can restore" permission.<br>
955 955
 Should include all users with upload permissions, otherwise they can't download
956 956
 their own uploads.
957
-PHP
957
+php
958 958
 				),
959 959
 
960 960
 			// The Main.PipelineApprovers
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -578,7 +578,7 @@
 block discarded – undo
578 578
 	 * Dear people of the future: If you are looking to optimize this, simply create a CurrentBuildSHA(), which can be
579 579
 	 * a lot faster. I presume you came here because of the Project display template, which only needs a SHA.
580 580
 	 *
581
-	 * @return false|DNDeployment
581
+	 * @return DNDeployment
582 582
 	 */
583 583
 	public function CurrentBuild() {
584 584
 		// The DeployHistory function is far too slow to use for this
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 				->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members)
775 775
 				->setTitle('Who can upload?')
776 776
 				->setDescription(
777
-					'Users who can upload archives linked to this environment into Deploynaut.<br />' .
777
+					'Users who can upload archives linked to this environment into Deploynaut.<br />'.
778 778
 					'Linking them to an environment allows limiting download permissions (see below).'
779 779
 				),
780 780
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		// Add actions
822 822
 		$action = new FormAction('check', 'Check Connection');
823 823
 		$action->setUseButtonTag(true);
824
-		$dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping';
824
+		$dataURL = Director::absoluteBaseURL().'naut/api/'.$this->Project()->Name.'/'.$this->Name.'/ping';
825 825
 		$action->setAttribute('data-url', $dataURL);
826 826
 		$fields->insertBefore($action, 'Name');
827 827
 
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
 	 */
835 835
 	public function onBeforeWrite() {
836 836
 		parent::onBeforeWrite();
837
-		if ($this->Name && $this->Name . '.rb' != $this->Filename) {
838
-			$this->Filename = $this->Name . '.rb';
837
+		if ($this->Name && $this->Name.'.rb' != $this->Filename) {
838
+			$this->Filename = $this->Name.'.rb';
839 839
 		}
840 840
 		$this->checkEnvironmentPath();
841 841
 		$this->writeConfigFile();
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 		if (!$this->Filename) {
886 886
 			return '';
887 887
 		}
888
-		return $this->DNData()->getEnvironmentDir() . '/' . $this->Project()->Name . '/' . $this->Filename;
888
+		return $this->DNData()->getEnvironmentDir().'/'.$this->Project()->Name.'/'.$this->Filename;
889 889
 	}
890 890
 
891 891
 	/**
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
 			&& $this->Filename
1040 1040
 			&& $this->CreateEnvConfig
1041 1041
 		) {
1042
-			$templateFile = $this->config()->template_file ?: BASE_PATH . '/deploynaut/environment.template';
1042
+			$templateFile = $this->config()->template_file ?: BASE_PATH.'/deploynaut/environment.template';
1043 1043
 			file_put_contents($this->getConfigFilename(), file_get_contents($templateFile));
1044 1044
 		} else if ($this->envFileExists() && $this->DeployConfig) {
1045 1045
 			file_put_contents($this->getConfigFilename(), $this->DeployConfig);
Please login to merge, or discard this patch.
code/model/DNProject.php 3 patches
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -929,7 +929,9 @@  discard block
 block discarded – undo
929 929
 	 * @return SS_List
930 930
 	 */
931 931
 	public function whoIsAllowedAny($codes) {
932
-		if(!is_array($codes)) $codes = array($codes);
932
+		if(!is_array($codes)) {
933
+			$codes = array($codes);
934
+		}
933 935
 
934 936
 		$SQLa_codes = Convert::raw2sql($codes);
935 937
 		$SQL_codes = join("','", $SQLa_codes);
@@ -991,7 +993,9 @@  discard block
 block discarded – undo
991 993
 			$member = Member::currentUser();
992 994
 		}
993 995
 
994
-		if(Permission::checkMember($member, 'ADMIN')) return true;
996
+		if(Permission::checkMember($member, 'ADMIN')) {
997
+			return true;
998
+		}
995 999
 
996 1000
 		$hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count();
997 1001
 		return ($hits>0 ? true : false);
@@ -1018,7 +1022,9 @@  discard block
 block discarded – undo
1018 1022
 			});
1019 1023
 
1020 1024
 			// If anything returns false then we're not ready.
1021
-			if($isDone) return min($isDone);
1025
+			if($isDone) {
1026
+				return min($isDone);
1027
+			}
1022 1028
 		}
1023 1029
 
1024 1030
 		return true;
@@ -1099,8 +1105,12 @@  discard block
 block discarded – undo
1099 1105
 	 * @return bool
1100 1106
 	 */
1101 1107
 	public function canCreate($member = null) {
1102
-		if(!$member) $member = Member::currentUser();
1103
-		if(!$member) return false;
1108
+		if(!$member) {
1109
+			$member = Member::currentUser();
1110
+		}
1111
+		if(!$member) {
1112
+			return false;
1113
+		}
1104 1114
 
1105 1115
 		if(Permission::checkMember($member, 'ADMIN')) {
1106 1116
 			return true;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1134,7 +1134,7 @@
 block discarded – undo
1134 1134
 	 * This is a proxy call to gitonmy that caches the information per project and sha
1135 1135
 	 *
1136 1136
 	 * @param string $sha
1137
-	 * @return false|\Gitonomy\Git\Commit
1137
+	 * @return Gitonomy\Git\Commit
1138 1138
 	 */
1139 1139
 	public function getCommit($sha) {
1140 1140
 		$repo = $this->getRepository();
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 		// add the administrators group as the viewers of the new project
111 111
 		$adminGroup = Group::get()->filter('Code', 'administrators')->first();
112
-		if($adminGroup && $adminGroup->exists()) {
112
+		if ($adminGroup && $adminGroup->exists()) {
113 113
 			$project->Viewers()->add($adminGroup);
114 114
 		}
115 115
 		return $project;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	public static function get_git_cache() {
132 132
 		return SS_Cache::factory('gitonomy', 'Output', [
133 133
 			'automatic_serialization' => true,
134
-			'lifetime' => 60*60*24*7 // seven days
134
+			'lifetime' => 60 * 60 * 24 * 7 // seven days
135 135
 		]);
136 136
 	}
137 137
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	public function getUsedQuotaMB($round = 2) {
145 145
 		$size = 0;
146 146
 
147
-		foreach($this->Environments() as $environment) {
148
-			foreach($environment->DataArchives()->filter('IsBackup', 0) as $archive) {
147
+		foreach ($this->Environments() as $environment) {
148
+			foreach ($environment->DataArchives()->filter('IsBackup', 0) as $archive) {
149 149
 				$size += $archive->ArchiveFile()->getAbsoluteSize();
150 150
 			}
151 151
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	public function getDiskQuotaMB() {
165 165
 		$size = $this->getField('DiskQuotaMB');
166 166
 
167
-		if(empty($size)) {
167
+		if (empty($size)) {
168 168
 			$defaults = $this->config()->get('defaults');
169 169
 			$size = (isset($defaults['DiskQuotaMB'])) ? $defaults['DiskQuotaMB'] : 0;
170 170
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function DiskQuotaUsagePercent() {
199 199
 		$quota = $this->getDiskQuotaMB();
200
-		if($quota > 0) {
200
+		if ($quota > 0) {
201 201
 			return $this->getUsedQuotaMB() * 100 / $quota;
202 202
 		}
203 203
 		return 100;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		$controller = Controller::curr();
215 215
 		$actionType = $controller->getField('CurrentActionType');
216 216
 
217
-		if(DNRoot::FlagSnapshotsEnabled() && $this->isProjectReady()) {
217
+		if (DNRoot::FlagSnapshotsEnabled() && $this->isProjectReady()) {
218 218
 			$list->push(new ArrayData(array(
219 219
 				'Link' => sprintf('naut/project/%s/snapshots', $this->Name),
220 220
 				'Title' => 'Snapshots',
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 	 * @return boolean
266 266
 	 */
267 267
 	public function canView($member = null) {
268
-		if(!$member) {
268
+		if (!$member) {
269 269
 			$member = Member::currentUser();
270 270
 		}
271 271
 
272
-		if(Permission::checkMember($member, 'ADMIN')) {
272
+		if (Permission::checkMember($member, 'ADMIN')) {
273 273
 			return true;
274 274
 		}
275 275
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 			return true;
293 293
 		}
294 294
 
295
-		return (bool)$this->Environments()->filterByCallback(function($env) use($member) {
295
+		return (bool) $this->Environments()->filterByCallback(function($env) use($member) {
296 296
 			return $env->canRestore($member);
297 297
 		})->Count();
298 298
 	}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 			return true;
313 313
 		}
314 314
 
315
-		return (bool)$this->Environments()->filterByCallback(function($env) use($member) {
315
+		return (bool) $this->Environments()->filterByCallback(function($env) use($member) {
316 316
 			return $env->canBackup($member);
317 317
 		})->Count();
318 318
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			return true;
333 333
 		}
334 334
 
335
-		return (bool)$this->Environments()->filterByCallback(function($env) use($member) {
335
+		return (bool) $this->Environments()->filterByCallback(function($env) use($member) {
336 336
 			return $env->canUploadArchive($member);
337 337
 		})->Count();
338 338
 	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			return true;
353 353
 		}
354 354
 
355
-		return (bool)$this->Environments()->filterByCallback(function($env) use($member) {
355
+		return (bool) $this->Environments()->filterByCallback(function($env) use($member) {
356 356
 			return $env->canDownloadArchive($member);
357 357
 		})->Count();
358 358
 	}
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
 	 */
370 370
 	public function canCreateEnvironments($member = null) {
371 371
 		$envType = $this->AllowedEnvironmentType;
372
-		if($envType) {
372
+		if ($envType) {
373 373
 			$env = Injector::inst()->get($envType);
374
-			if($env instanceof EnvironmentCreateBackend) {
374
+			if ($env instanceof EnvironmentCreateBackend) {
375 375
 				return $this->allowed(DNRoot::ALLOW_CREATE_ENVIRONMENT, $member);
376 376
 			}
377 377
 		}
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 	 * @return array
408 408
 	 */
409 409
 	public function getProcessEnv() {
410
-		if(file_exists($this->getPrivateKeyPath())) {
410
+		if (file_exists($this->getPrivateKeyPath())) {
411 411
 			// Key-pair is available, use it.
412 412
 			$processEnv = array(
413 413
 				'IDENT_KEY' => $this->getPrivateKeyPath(),
414
-				'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh"
414
+				'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh"
415 415
 			);
416 416
 		} else {
417 417
 			$processEnv = array();
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 * @return DNBranchList
453 453
 	 */
454 454
 	public function DNBranchList() {
455
-		if($this->CVSPath && !$this->repoExists()) {
455
+		if ($this->CVSPath && !$this->repoExists()) {
456 456
 			$this->cloneRepo();
457 457
 		}
458 458
 		return DNBranchList::create($this, $this->DNData());
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	 * @return DNReferenceList
465 465
 	 */
466 466
 	public function DNTagList() {
467
-		if($this->CVSPath && !$this->repoExists()) {
467
+		if ($this->CVSPath && !$this->repoExists()) {
468 468
 			$this->cloneRepo();
469 469
 		}
470 470
 		return DNReferenceList::create($this, $this->DNData(), null, null, true);
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 * @return false|Gitonomy\Git\Repository
475 475
 	 */
476 476
 	public function getRepository() {
477
-		if(!$this->repoExists()) {
477
+		if (!$this->repoExists()) {
478 478
 			return false;
479 479
 		}
480 480
 
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	public function DNEnvironmentList() {
491 491
 
492
-		if(!self::$_current_member_cache) {
492
+		if (!self::$_current_member_cache) {
493 493
 			self::$_current_member_cache = Member::currentUser();
494 494
 		}
495 495
 
496
-		if(self::$_current_member_cache === false) {
496
+		if (self::$_current_member_cache === false) {
497 497
 			return new ArrayList();
498 498
 		}
499 499
 
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
 	 * @return false|DNDeployment
519 519
 	 */
520 520
 	public function currentBuilds() {
521
-		if(!isset(self::$relation_cache['currentBuilds.'.$this->ID])) {
521
+		if (!isset(self::$relation_cache['currentBuilds.'.$this->ID])) {
522 522
 			$currentBuilds = array();
523
-			foreach($this->Environments() as $env) {
523
+			foreach ($this->Environments() as $env) {
524 524
 				$currentBuilds[$env->Name] = $env->CurrentBuild();
525 525
 			}
526 526
 			self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * @return string|null
541 541
 	 */
542 542
 	public function CreateEnvironmentLink() {
543
-		if($this->canCreateEnvironments()) {
543
+		if ($this->canCreateEnvironments()) {
544 544
 			return $this->Link('createenv');
545 545
 		}
546 546
 		return null;
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 	 */
559 559
 	public function IsStarred() {
560 560
 		$member = Member::currentUser();
561
-		if($member === null) {
561
+		if ($member === null) {
562 562
 			return false;
563 563
 		}
564 564
 		$favourited = $this->StarredBy()->filter('MemberID', $member->ID);
565
-		if($favourited->count() == 0) {
565
+		if ($favourited->count() == 0) {
566 566
 			return false;
567 567
 		}
568 568
 		return true;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 
618 618
 		$environmentTypes = ClassInfo::implementorsOf('EnvironmentCreateBackend');
619 619
 		$types = array();
620
-		foreach($environmentTypes as $type) {
620
+		foreach ($environmentTypes as $type) {
621 621
 			$types[$type] = $type;
622 622
 		}
623 623
 
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 	 */
642 642
 	public function setCreateProjectFolderField(&$fields) {
643 643
 		// Check if the capistrano project folder exists
644
-		if(!$this->Name) {
644
+		if (!$this->Name) {
645 645
 			return;
646 646
 		}
647 647
 
648
-		if($this->projectFolderExists()) {
648
+		if ($this->projectFolderExists()) {
649 649
 			return;
650 650
 		}
651 651
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 */
678 678
 	public function cloneRepo() {
679 679
 		// Avoid this being called multiple times in the same request
680
-		if(!isset(self::$has_cloned_cache[$this->ID])) {
680
+		if (!isset(self::$has_cloned_cache[$this->ID])) {
681 681
 			$fetch = DNGitFetch::create();
682 682
 			$fetch->ProjectID = $this->ID;
683 683
 			$fetch->write();
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	public function onBeforeWrite() {
702 702
 		parent::onBeforeWrite();
703 703
 
704
-		if($this->CreateEnvFolder && !file_exists($this->getProjectFolderPath())) {
704
+		if ($this->CreateEnvFolder && !file_exists($this->getProjectFolderPath())) {
705 705
 			mkdir($this->getProjectFolderPath());
706 706
 		}
707 707
 	}
@@ -709,12 +709,12 @@  discard block
 block discarded – undo
709 709
 	public function onAfterWrite() {
710 710
 		parent::onAfterWrite();
711 711
 
712
-		if(!$this->CVSPath) {
712
+		if (!$this->CVSPath) {
713 713
 			return;
714 714
 		}
715 715
 
716 716
 		$changedFields = $this->getChangedFields(true, 2);
717
-		if(isset($changedFields['CVSPath']) || isset($changedFields['Name'])) {
717
+		if (isset($changedFields['CVSPath']) || isset($changedFields['Name'])) {
718 718
 			$this->cloneRepo();
719 719
 		}
720 720
 	}
@@ -726,22 +726,22 @@  discard block
 block discarded – undo
726 726
 		parent::onAfterDelete();
727 727
 
728 728
 		// Delete related environments
729
-		foreach($this->Environments() as $env) {
729
+		foreach ($this->Environments() as $env) {
730 730
 			$env->delete();
731 731
 		}
732 732
 
733 733
 		// Delete local repository
734
-		if(file_exists($this->getLocalCVSPath())) {
734
+		if (file_exists($this->getLocalCVSPath())) {
735 735
 			Filesystem::removeFolder($this->getLocalCVSPath());
736 736
 		}
737 737
 
738 738
 		// Delete project template
739
-		if(file_exists($this->getProjectFolderPath()) && Config::inst()->get('DNEnvironment', 'allow_web_editing')) {
739
+		if (file_exists($this->getProjectFolderPath()) && Config::inst()->get('DNEnvironment', 'allow_web_editing')) {
740 740
 			Filesystem::removeFolder($this->getProjectFolderPath());
741 741
 		}
742 742
 
743 743
 		// Delete the deploy key
744
-		if(file_exists($this->getKeyDir())) {
744
+		if (file_exists($this->getKeyDir())) {
745 745
 			Filesystem::removeFolder($this->getKeyDir());
746 746
 		}
747 747
 	}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	public function getPublicKey() {
755 755
 		$key = $this->getPublicKeyPath();
756 756
 
757
-		if(file_exists($key)) {
757
+		if (file_exists($key)) {
758 758
 			return trim(file_get_contents($key));
759 759
 		}
760 760
 	}
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 	 * @return string|null
766 766
 	 */
767 767
 	public function getPublicKeyPath() {
768
-		if($privateKey = $this->getPrivateKeyPath()) {
769
-			return $privateKey . '.pub';
768
+		if ($privateKey = $this->getPrivateKeyPath()) {
769
+			return $privateKey.'.pub';
770 770
 		}
771 771
 		return null;
772 772
 	}
@@ -778,10 +778,10 @@  discard block
 block discarded – undo
778 778
 	 */
779 779
 	public function getPrivateKeyPath() {
780 780
 		$keyDir = $this->getKeyDir();
781
-		if(!empty($keyDir)) {
781
+		if (!empty($keyDir)) {
782 782
 			$filter = FileNameFilter::create();
783 783
 			$name = $filter->filter($this->Name);
784
-			return $keyDir . '/' . $name;
784
+			return $keyDir.'/'.$name;
785 785
 		}
786 786
 		return null;
787 787
 	}
@@ -793,14 +793,14 @@  discard block
 block discarded – undo
793 793
 	 */
794 794
 	public function getKeyDir() {
795 795
 		$keyDir = $this->DNData()->getKeyDir();
796
-		if(!$keyDir) {
796
+		if (!$keyDir) {
797 797
 			return null;
798 798
 		}
799 799
 
800 800
 		$filter = FileNameFilter::create();
801 801
 		$name = $filter->filter($this->Name);
802 802
 
803
-		return $this->DNData()->getKeyDir() . '/' . $name;
803
+		return $this->DNData()->getKeyDir().'/'.$name;
804 804
 	}
805 805
 
806 806
 	/**
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	 * @param GridField $environments
811 811
 	 */
812 812
 	protected function setEnvironmentFields(&$fields, $environments) {
813
-		if(!$environments) {
813
+		if (!$environments) {
814 814
 			return;
815 815
 		}
816 816
 
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		$environments->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
820 820
 		$environments->getConfig()->removeComponentsByType('GridFieldDeleteAction');
821 821
 		$environments->getConfig()->removeComponentsByType('GridFieldPageCount');
822
-		if(Config::inst()->get('DNEnvironment', 'allow_web_editing')) {
822
+		if (Config::inst()->get('DNEnvironment', 'allow_web_editing')) {
823 823
 			$addNewRelease = new GridFieldAddNewButton('toolbar-header-right');
824 824
 			$addNewRelease->setButtonName('Add');
825 825
 			$environments->getConfig()->addComponent($addNewRelease);
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	 */
836 836
 	public function getRepositoryURL() {
837 837
 		$showUrl = Config::inst()->get($this->class, 'show_repository_url');
838
-		if($showUrl) {
838
+		if ($showUrl) {
839 839
 			return $this->CVSPath;
840 840
 		}
841 841
 	}
@@ -887,9 +887,9 @@  discard block
 block discarded – undo
887 887
 		$interfaces = $this->config()->repository_interfaces;
888 888
 
889 889
 		/* Look for each whitelisted hostname */
890
-		foreach($interfaces as $host => $interface) {
890
+		foreach ($interfaces as $host => $interface) {
891 891
 			/* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */
892
-			if(preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) {
892
+			if (preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) {
893 893
 
894 894
 				$path = $match[2];
895 895
 
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 
900 900
 				$components = explode('.', $host);
901 901
 
902
-				foreach($regex as $pattern => $replacement) {
903
-					$path = preg_replace('/' . $pattern . '/', $replacement, $path);
902
+				foreach ($regex as $pattern => $replacement) {
903
+					$path = preg_replace('/'.$pattern.'/', $replacement, $path);
904 904
 				}
905 905
 
906
-				$uxurl = Controller::join_links($scheme . '://', $host, $path);
906
+				$uxurl = Controller::join_links($scheme.'://', $host, $path);
907 907
 
908
-				if(array_key_exists('commit', $interface) && $interface['commit'] == false) {
908
+				if (array_key_exists('commit', $interface) && $interface['commit'] == false) {
909 909
 					$commiturl = false;
910 910
 				} else {
911 911
 					$commiturl = Controller::join_links(
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 	 * @return SS_List
950 950
 	 */
951 951
 	public function whoIsAllowedAny($codes) {
952
-		if(!is_array($codes)) $codes = array($codes);
952
+		if (!is_array($codes)) $codes = array($codes);
953 953
 
954 954
 		$SQLa_codes = Convert::raw2sql($codes);
955 955
 		$SQL_codes = join("','", $SQLa_codes);
@@ -988,11 +988,11 @@  discard block
 block discarded – undo
988 988
 	 */
989 989
 	public function groupAllowed($permissionCode, Group $group) {
990 990
 		$viewers = $this->Viewers();
991
-		if(!$viewers->find('ID', $group->ID)) {
991
+		if (!$viewers->find('ID', $group->ID)) {
992 992
 			return false;
993 993
 		}
994 994
 		$groups = Permission::get_groups_by_permission($permissionCode);
995
-		if(!$groups->find('ID', $group->ID)) {
995
+		if (!$groups->find('ID', $group->ID)) {
996 996
 			return false;
997 997
 		}
998 998
 		return true;
@@ -1011,10 +1011,10 @@  discard block
 block discarded – undo
1011 1011
 			$member = Member::currentUser();
1012 1012
 		}
1013 1013
 
1014
-		if(Permission::checkMember($member, 'ADMIN')) return true;
1014
+		if (Permission::checkMember($member, 'ADMIN')) return true;
1015 1015
 
1016 1016
 		$hits = $this->whoIsAllowedAny($codes)->filter('Member.ID', $member->ID)->count();
1017
-		return ($hits>0 ? true : false);
1017
+		return ($hits > 0 ? true : false);
1018 1018
 	}
1019 1019
 
1020 1020
 	/**
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	 * @return bool
1024 1024
 	 */
1025 1025
 	public function isProjectReady() {
1026
-		if($this->getRunningInitialEnvironmentCreations()->count() > 0) {
1026
+		if ($this->getRunningInitialEnvironmentCreations()->count() > 0) {
1027 1027
 			// We're still creating the initial environments for this project so we're
1028 1028
 			// not quite done
1029 1029
 			return false;
@@ -1032,13 +1032,13 @@  discard block
 block discarded – undo
1032 1032
 		// Provide a hook for further checks. Logic stolen from
1033 1033
 		// {@see DataObject::extendedCan()}
1034 1034
 		$isDone = $this->extend('isProjectReady');
1035
-		if($isDone && is_array($isDone)) {
1035
+		if ($isDone && is_array($isDone)) {
1036 1036
 			$isDone = array_filter($isDone, function($val) {
1037 1037
 				return !is_null($val);
1038 1038
 			});
1039 1039
 
1040 1040
 			// If anything returns false then we're not ready.
1041
-			if($isDone) return min($isDone);
1041
+			if ($isDone) return min($isDone);
1042 1042
 		}
1043 1043
 
1044 1044
 		return true;
@@ -1088,25 +1088,25 @@  discard block
 block discarded – undo
1088 1088
 	 */
1089 1089
 	protected function validate() {
1090 1090
 		$validation = parent::validate();
1091
-		if($validation->valid()) {
1092
-			if(empty($this->Name)) {
1091
+		if ($validation->valid()) {
1092
+			if (empty($this->Name)) {
1093 1093
 				return $validation->error('The stack must have a name.');
1094 1094
 			}
1095 1095
 
1096 1096
 			// The name is used to build filepaths so should be restricted
1097
-			if(!preg_match('/^[a-zA-Z0-9][a-zA-Z0-9\-\_]+$/', $this->Name)) {
1097
+			if (!preg_match('/^[a-zA-Z0-9][a-zA-Z0-9\-\_]+$/', $this->Name)) {
1098 1098
 				return $validation->error('Project name can only contain alphanumeric, hyphens and underscores.');
1099 1099
 			}
1100 1100
 
1101
-			if(empty($this->CVSPath)) {
1101
+			if (empty($this->CVSPath)) {
1102 1102
 				return $validation->error('You must provide a repository URL.');
1103 1103
 			}
1104 1104
 
1105 1105
 			$existing = DNProject::get()->filter('Name', $this->Name);
1106
-			if($this->ID) {
1106
+			if ($this->ID) {
1107 1107
 				$existing = $existing->exclude('ID', $this->ID);
1108 1108
 			}
1109
-			if($existing->count() > 0) {
1109
+			if ($existing->count() > 0) {
1110 1110
 				return $validation->error('A stack already exists with that name.');
1111 1111
 			}
1112 1112
 		}
@@ -1119,10 +1119,10 @@  discard block
 block discarded – undo
1119 1119
 	 * @return bool
1120 1120
 	 */
1121 1121
 	public function canCreate($member = null) {
1122
-		if(!$member) $member = Member::currentUser();
1123
-		if(!$member) return false;
1122
+		if (!$member) $member = Member::currentUser();
1123
+		if (!$member) return false;
1124 1124
 
1125
-		if(Permission::checkMember($member, 'ADMIN')) {
1125
+		if (Permission::checkMember($member, 'ADMIN')) {
1126 1126
 			return true;
1127 1127
 		}
1128 1128
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 	 */
1139 1139
 	public function getCommit($sha) {
1140 1140
 		$repo = $this->getRepository();
1141
-		if(!$repo) {
1141
+		if (!$repo) {
1142 1142
 			return false;
1143 1143
 		}
1144 1144
 
Please login to merge, or discard this patch.
code/control/DNRoot.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -961,7 +961,7 @@
 block discarded – undo
961 961
 	 * @param array $data
962 962
 	 * @param Form $form
963 963
 	 *
964
-	 * @return bool|HTMLText|SS_HTTPResponse
964
+	 * @return SS_HTTPResponse|null
965 965
 	 */
966 966
 	public function doCreateEnvironment($data, Form $form) {
967 967
 		$this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		Requirements::javascript('deploynaut/javascript/material.js');
179 179
 
180 180
 		// Load the buildable dependencies only if not loaded centrally.
181
-		if (!is_dir(BASE_PATH . DIRECTORY_SEPARATOR . 'static')) {
181
+		if (!is_dir(BASE_PATH.DIRECTORY_SEPARATOR.'static')) {
182 182
 			if (\Director::isDev()) {
183 183
 				\Requirements::javascript('deploynaut/static/bundle-debug.js');
184 184
 			} else {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		}
243 243
 
244 244
 		// Block framework jquery
245
-		Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
245
+		Requirements::block(FRAMEWORK_DIR.'/thirdparty/jquery/jquery.js');
246 246
 
247 247
 		self::include_requirements();
248 248
 	}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @return \SS_HTTPResponse
262 262
 	 */
263 263
 	public function index(SS_HTTPRequest $request) {
264
-		return $this->redirect($this->Link() . 'projects/');
264
+		return $this->redirect($this->Link().'projects/');
265 265
 	}
266 266
 
267 267
 	/**
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		// Framing an environment as a "group of people with download access"
390 390
 		// makes more sense to the user here, while still allowing us to enforce
391 391
 		// environment specific restrictions on downloading the file later on.
392
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
392
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
393 393
 			return $item->canUploadArchive();
394 394
 		});
395 395
 		$envsMap = [];
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		$form->disableSecurityToken();
422 422
 		$form->addExtraClass('fields-wide');
423 423
 		// Tweak the action so it plays well with our fake URL structure.
424
-		$form->setFormAction($project->Link() . '/UploadSnapshotForm');
424
+		$form->setFormAction($project->Link().'/UploadSnapshotForm');
425 425
 
426 426
 		return $form;
427 427
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		}
443 443
 
444 444
 		$validEnvs = $project->DNEnvironmentList()
445
-			->filterByCallback(function ($item) {
445
+			->filterByCallback(function($item) {
446 446
 				return $item->canUploadArchive();
447 447
 			});
448 448
 
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 		$dataArchive->DataTransfers()->add($dataTransfer);
472 472
 		$form->saveInto($dataArchive);
473 473
 		$dataArchive->write();
474
-		$workingDir = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'deploynaut-transfer-' . $dataTransfer->ID;
474
+		$workingDir = TEMP_FOLDER.DIRECTORY_SEPARATOR.'deploynaut-transfer-'.$dataTransfer->ID;
475 475
 
476
-		$cleanupFn = function () use ($workingDir, $dataTransfer, $dataArchive) {
476
+		$cleanupFn = function() use ($workingDir, $dataTransfer, $dataArchive) {
477 477
 			$process = new AbortableProcess(sprintf('rm -rf %s', escapeshellarg($workingDir)));
478 478
 			$process->setTimeout(120);
479 479
 			$process->run();
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		// Framing an environment as a "group of people with download access"
548 548
 		// makes more sense to the user here, while still allowing us to enforce
549 549
 		// environment specific restrictions on downloading the file later on.
550
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
550
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
551 551
 			return $item->canUploadArchive();
552 552
 		});
553 553
 		$envsMap = [];
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 		$form->disableSecurityToken();
574 574
 		$form->addExtraClass('fields-wide');
575 575
 		// Tweak the action so it plays well with our fake URL structure.
576
-		$form->setFormAction($project->Link() . '/PostSnapshotForm');
576
+		$form->setFormAction($project->Link().'/PostSnapshotForm');
577 577
 
578 578
 		return $form;
579 579
 	}
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 			return $this->project404Response();
593 593
 		}
594 594
 
595
-		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
595
+		$validEnvs = $project->DNEnvironmentList()->filterByCallback(function($item) {
596 596
 			return $item->canUploadArchive();
597 597
 		});
598 598
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 		$branchName = $request->getVar('name');
713 713
 		$branch = $project->DNBranchList()->byName($branchName);
714 714
 		if (!$branch) {
715
-			return new SS_HTTPResponse("Branch '" . Convert::raw2xml($branchName) . "' not found.", 404);
715
+			return new SS_HTTPResponse("Branch '".Convert::raw2xml($branchName)."' not found.", 404);
716 716
 		}
717 717
 
718 718
 		return $this->render([
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 		);
850 850
 
851 851
 		// Tweak the action so it plays well with our fake URL structure.
852
-		$form->setFormAction($project->Link() . '/CreateEnvironmentForm');
852
+		$form->setFormAction($project->Link().'/CreateEnvironmentForm');
853 853
 
854 854
 		return $form;
855 855
 	}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 		$job->write();
883 883
 		$job->start();
884 884
 
885
-		return $this->redirect($project->Link('createenv') . '/' . $job->ID);
885
+		return $this->redirect($project->Link('createenv').'/'.$job->ID);
886 886
 	}
887 887
 
888 888
 	/**
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 			return $body;
1081 1081
 		}
1082 1082
 
1083
-		$form->setFormAction($this->getRequest()->getURL() . '/DeployForm');
1083
+		$form->setFormAction($this->getRequest()->getURL().'/DeployForm');
1084 1084
 		return $form;
1085 1085
 	}
1086 1086
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 		$deployment->getMachine()->apply(DNDeployment::TR_QUEUE);
1347 1347
 
1348 1348
 		return json_encode([
1349
-			'url' => Director::absoluteBaseURL() . $deployment->Link()
1349
+			'url' => Director::absoluteBaseURL().$deployment->Link()
1350 1350
 		], JSON_PRETTY_PRINT);
1351 1351
 	}
1352 1352
 
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 	 */
1470 1470
 	public function getDataTransferForm(SS_HTTPRequest $request = null) {
1471 1471
 		// Performs canView permission check by limiting visible projects
1472
-		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1472
+		$envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function($item) {
1473 1473
 			return $item->canBackup();
1474 1474
 		});
1475 1475
 
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 					->addExtraClass('btn')
1492 1492
 			)
1493 1493
 		);
1494
-		$form->setFormAction($this->getRequest()->getURL() . '/DataTransferForm');
1494
+		$form->setFormAction($this->getRequest()->getURL().'/DataTransferForm');
1495 1495
 
1496 1496
 		return $form;
1497 1497
 	}
@@ -1517,12 +1517,12 @@  discard block
 block discarded – undo
1517 1517
 		// Validate direction.
1518 1518
 		if ($data['Direction'] == 'get') {
1519 1519
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1520
-				->filterByCallback(function ($item) {
1520
+				->filterByCallback(function($item) {
1521 1521
 					return $item->canBackup();
1522 1522
 				});
1523 1523
 		} else if ($data['Direction'] == 'push') {
1524 1524
 			$validEnvs = $this->getCurrentProject()->DNEnvironmentList()
1525
-				->filterByCallback(function ($item) {
1525
+				->filterByCallback(function($item) {
1526 1526
 					return $item->canRestore();
1527 1527
 				});
1528 1528
 		} else {
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 
1654 1654
 		// Performs canView permission check by limiting visible projects
1655 1655
 		$project = $this->getCurrentProject();
1656
-		$envs = $project->DNEnvironmentList()->filterByCallback(function ($item) {
1656
+		$envs = $project->DNEnvironmentList()->filterByCallback(function($item) {
1657 1657
 			return $item->canRestore();
1658 1658
 		});
1659 1659
 
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 					->addExtraClass('btn')
1693 1693
 			)
1694 1694
 		);
1695
-		$form->setFormAction($project->Link() . '/DataTransferRestoreForm');
1695
+		$form->setFormAction($project->Link().'/DataTransferRestoreForm');
1696 1696
 
1697 1697
 		return $form;
1698 1698
 	}
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
 					->addExtraClass('btn')
1791 1791
 			)
1792 1792
 		);
1793
-		$form->setFormAction($project->Link() . '/DeleteForm');
1793
+		$form->setFormAction($project->Link().'/DeleteForm');
1794 1794
 
1795 1795
 		return $form;
1796 1796
 	}
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 					->addExtraClass('btn')
1897 1897
 			)
1898 1898
 		);
1899
-		$form->setFormAction($this->getCurrentProject()->Link() . '/MoveForm');
1899
+		$form->setFormAction($this->getCurrentProject()->Link().'/MoveForm');
1900 1900
 
1901 1901
 		return $form;
1902 1902
 	}
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
 		$transfers = DNDataTransfer::get()
2158 2158
 			->filter('EnvironmentID', $environments)
2159 2159
 			->filterByCallback(
2160
-				function ($record) {
2160
+				function($record) {
2161 2161
 					return
2162 2162
 						$record->Environment()->canRestore() || // Ensure member can perform an action on the transfers env
2163 2163
 						$record->Environment()->canBackup() ||
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
 	 */
2283 2283
 	protected function project404Response() {
2284 2284
 		return new SS_HTTPResponse(
2285
-			"Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2285
+			"Project '".Convert::raw2xml($this->getRequest()->param('Project'))."' not found.",
2286 2286
 			404
2287 2287
 		);
2288 2288
 	}
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 	 */
2293 2293
 	protected function environment404Response() {
2294 2294
 		$envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2295
-		return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2295
+		return new SS_HTTPResponse("Environment '".$envName."' not found.", 404);
2296 2296
 	}
2297 2297
 
2298 2298
 	/**
Please login to merge, or discard this patch.
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/model/jobs/DNDeployment.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,12 +205,16 @@
 block discarded – undo
205 205
 	 */
206 206
 	public function getFullDeployMessages() {
207 207
 		$strategy = $this->getDeploymentStrategy();
208
-		if ($strategy->getActionCode()!=='full') return null;
208
+		if ($strategy->getActionCode()!=='full') {
209
+			return null;
210
+		}
209 211
 
210 212
 		$changes = $strategy->getChangesModificationNeeded();
211 213
 		$messages = [];
212 214
 		foreach ($changes as $change => $details) {
213
-			if ($change==='Code version') continue;
215
+			if ($change==='Code version') {
216
+				continue;
217
+			}
214 218
 
215 219
 			$messages[] = [
216 220
 				'Flag' => sprintf(
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -82,6 +82,9 @@
 block discarded – undo
82 82
 		'Deployer.Name' => 'Deployer'
83 83
 	);
84 84
 
85
+	/**
86
+	 * @param false|string $token
87
+	 */
85 88
 	public function setResqueToken($token) {
86 89
 		$this->ResqueToken = $token;
87 90
 	}
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
 	public function LogLink() {
111
-		return $this->Link() . '/log';
111
+		return $this->Link().'/log';
112 112
 	}
113 113
 
114 114
 	public function canView($member = null) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return \Gitonomy\Git\Repository|null
155 155
 	 */
156 156
 	public function getRepository() {
157
-		if(!$this->SHA) {
157
+		if (!$this->SHA) {
158 158
 			return null;
159 159
 		}
160 160
 		return $this->Environment()->Project()->getRepository();
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function getCommit() {
169 169
 		$repo = $this->getRepository();
170
-		if($repo) {
170
+		if ($repo) {
171 171
 			try {
172 172
 				return $this->Environment()->getCommit($this->SHA);
173
-			} catch(Gitonomy\Git\Exception\ReferenceNotFoundException $ex) {
173
+			} catch (Gitonomy\Git\Exception\ReferenceNotFoundException $ex) {
174 174
 				return null;
175 175
 			}
176 176
 		}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		if (!$interface) {
196 196
 			return null;
197 197
 		}
198
-		return $interface->CommitURL . '/' . $this->SHA;
198
+		return $interface->CommitURL.'/'.$this->SHA;
199 199
 	}
200 200
 
201 201
 	/**
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function getCommitMessage() {
207 207
 		$commit = $this->getCommit();
208
-		if($commit) {
208
+		if ($commit) {
209 209
 			try {
210 210
 				return Convert::raw2xml($this->Environment()->getCommitMessage($commit));
211
-			} catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) {
211
+			} catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) {
212 212
 				return null;
213 213
 			}
214 214
 		}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$this->Environment()->getCommitTags($commit);
226 226
 		$returnTags = [];
227 227
 		if (!empty($tags)) {
228
-			foreach($tags as $tag) {
228
+			foreach ($tags as $tag) {
229 229
 				$field = Varchar::create('Tag', '255');
230 230
 				$field->setValue($tag->getName());
231 231
 				$returnTags[] = $field;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	public function getFullDeployMessages() {
244 244
 		$strategy = $this->getDeploymentStrategy();
245
-		if ($strategy->getActionCode()!=='full') return null;
245
+		if ($strategy->getActionCode() !== 'full') return null;
246 246
 
247 247
 		$changes = $strategy->getChangesModificationNeeded();
248 248
 		$messages = [];
249 249
 		foreach ($changes as $change => $details) {
250
-			if ($change==='Code version') continue;
250
+			if ($change === 'Code version') continue;
251 251
 
252 252
 			$messages[] = [
253 253
 				'Flag' => sprintf(
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function getTag() {
277 277
 		$tags = $this->getTags();
278
-		if($tags->count() > 0) {
278
+		if ($tags->count() > 0) {
279 279
 			return $tags->last();
280 280
 		}
281 281
 		return null;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	public function getChanges() {
301 301
 		$list = new ArrayList();
302 302
 		$strategy = $this->getDeploymentStrategy();
303
-		foreach($strategy->getChanges() as $name => $change) {
303
+		foreach ($strategy->getChanges() as $name => $change) {
304 304
 			$changed = (isset($change['from']) && isset($change['to'])) ? $change['from'] != $change['to'] : null;
305 305
 			$description = isset($change['description']) ? $change['description'] : '';
306 306
 			$compareUrl = null;
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 		// Make sure we use the SHA as it was written into this DNDeployment.
351 351
 		$args['sha'] = $this->SHA;
352 352
 
353
-		if(!$this->DeployerID) {
353
+		if (!$this->DeployerID) {
354 354
 			$this->DeployerID = Member::currentUserID();
355 355
 		}
356 356
 
357
-		if($this->DeployerID) {
357
+		if ($this->DeployerID) {
358 358
 			$deployer = $this->Deployer();
359 359
 			$message = sprintf(
360 360
 				'Deploy to %s initiated by %s (%s), with IP address %s',
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/StateMachineFactory.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@
 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])) {
62
+			return;
63
+		}
62 64
 
63 65
 		$transitions = $this->config()->handlers[$class];
64 66
 		foreach ($transitions as $transName => $handlers) {
Please login to merge, or discard this patch.
code/control/DeployDispatcher.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 	 *
47 47
 	 * @param \SS_HTTPRequest $request
48 48
 	 *
49
-	 * @return \HTMLText|\SS_HTTPResponse
49
+	 * @return SS_HTTPResponse|null
50 50
 	 */
51 51
 	public function index(\SS_HTTPRequest $request) {
52 52
 		return $this->redirect(\Controller::join_links($this->Link(), 'history'), 302);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -263,12 +263,12 @@
 block discarded – undo
263 263
 
264 264
 		// failover for older deployments
265 265
 		$started = $deployment->Created;
266
-		if($deployment->DeployStarted) {
266
+		if ($deployment->DeployStarted) {
267 267
 			$started = $deployment->DeployStarted;
268 268
 		}
269 269
 
270 270
 		$requested = $deployment->Created;
271
-		if($deployment->DeployRequested) {
271
+		if ($deployment->DeployRequested) {
272 272
 			$requested = $deployment->DeployRequested;
273 273
 		}
274 274
 
Please login to merge, or discard this patch.