Completed
Pull Request — master (#658)
by Stig
10:45 queued 04:00
created
code/model/DNProject.php 2 patches
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/model/jobs/DNDeployment.php 1 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/GitDispatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	protected function getUpdateStatus($ID) {
169 169
 		$ping = DNGitFetch::get()->byID($ID);
170 170
 		if (!$ping) {
171
-			return $this->getAPIResponse(['message' => 'GIT update (' . $ID . ') not found'], 404);
171
+			return $this->getAPIResponse(['message' => 'GIT update ('.$ID.') not found'], 404);
172 172
 		}
173 173
 		$output = [
174 174
 			'id' => $ID,
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$fetch->write();
190 190
 		$fetch->start();
191 191
 
192
-		$location = Director::absoluteBaseURL() . $this->Link() . '/update/' . $fetch->ID;
192
+		$location = Director::absoluteBaseURL().$this->Link().'/update/'.$fetch->ID;
193 193
 		$output = [
194 194
 			'message' => 'git fetch has been queued',
195 195
 			'id' => $fetch->ID,
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			$commit = $this->project->getCommit($branch->SHA());
213 213
 			$branches[] = [
214 214
 				'key' => $branch->SHA(),
215
-				'value' => $branch->Name() . ' (' . $this->project->getCommitMessage($commit) . ')',
215
+				'value' => $branch->Name().' ('.$this->project->getCommitMessage($commit).')',
216 216
 			];
217 217
 		}
218 218
 		return $branches;
Please login to merge, or discard this patch.