@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function php($data) { |
14 | 14 | // Check release method |
15 | - if (empty($data['SelectRelease']) |
|
15 | + if(empty($data['SelectRelease']) |
|
16 | 16 | || !in_array($data['SelectRelease'], ['Tag', 'Branch', 'Redeploy', 'SHA', 'FilteredCommits']) |
17 | 17 | ) { |
18 | 18 | $method = empty($data['SelectRelease']) ? '(blank)' : $data['SelectRelease']; |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | * @return string SHA of selected build |
68 | 68 | */ |
69 | 69 | public function getSelectedBuild($data) { |
70 | - if (isset($data['SelectRelease']) && !empty($data[$data['SelectRelease']])) { |
|
70 | + if(isset($data['SelectRelease']) && !empty($data[$data['SelectRelease']])) { |
|
71 | 71 | // Filter out the tag/branch name if required |
72 | 72 | $array = explode('-', $data[$data['SelectRelease']]); |
73 | 73 | return reset($array); |
74 | 74 | } |
75 | - if (isset($data['FilteredCommits']) && !empty($data['FilteredCommits'])) { |
|
75 | + if(isset($data['FilteredCommits']) && !empty($data['FilteredCommits'])) { |
|
76 | 76 | return $data['FilteredCommits']; |
77 | 77 | } |
78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | protected function buildCommitSelector($project) { |
87 | 87 | // Branches |
88 | 88 | $branches = []; |
89 | - foreach ($project->DNBranchList() as $branch) { |
|
89 | + foreach($project->DNBranchList() as $branch) { |
|
90 | 90 | $sha = $branch->SHA(); |
91 | 91 | $name = $branch->Name(); |
92 | 92 | $branchValue = sprintf("%s (%s, %s old)", |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | substr($sha, 0, 8), |
95 | 95 | $branch->LastUpdated()->TimeDiff() |
96 | 96 | ); |
97 | - $branches[$sha . '-' . $name] = $branchValue; |
|
97 | + $branches[$sha.'-'.$name] = $branchValue; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // Tags |
101 | 101 | $tags = []; |
102 | - foreach ($project->DNTagList()->setLimit(null) as $tag) { |
|
102 | + foreach($project->DNTagList()->setLimit(null) as $tag) { |
|
103 | 103 | $sha = $tag->SHA(); |
104 | 104 | $name = $tag->Name(); |
105 | 105 | $tagValue = sprintf("%s (%s, %s old)", |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | substr($sha, 0, 8), |
108 | 108 | $branch->LastUpdated()->TimeDiff() |
109 | 109 | ); |
110 | - $tags[$sha . '-' . $tag] = $tagValue; |
|
110 | + $tags[$sha.'-'.$tag] = $tagValue; |
|
111 | 111 | } |
112 | 112 | $tags = array_reverse($tags); |
113 | 113 | |
114 | 114 | // Past deployments |
115 | 115 | $redeploy = []; |
116 | - foreach ($project->DNEnvironmentList() as $dnEnvironment) { |
|
116 | + foreach($project->DNEnvironmentList() as $dnEnvironment) { |
|
117 | 117 | $envName = $dnEnvironment->Name; |
118 | - foreach ($dnEnvironment->DeployHistory() as $deploy) { |
|
118 | + foreach($dnEnvironment->DeployHistory() as $deploy) { |
|
119 | 119 | $sha = $deploy->SHA; |
120 | - if (!isset($redeploy[$envName])) { |
|
120 | + if(!isset($redeploy[$envName])) { |
|
121 | 121 | $redeploy[$envName] = []; |
122 | 122 | } |
123 | - if (!isset($redeploy[$envName][$sha])) { |
|
123 | + if(!isset($redeploy[$envName][$sha])) { |
|
124 | 124 | $pastValue = sprintf("%s (deployed %s)", |
125 | 125 | substr($sha, 0, 8), |
126 | 126 | $deploy->obj('LastEdited')->Ago() |
@@ -132,21 +132,21 @@ discard block |
||
132 | 132 | |
133 | 133 | // Merge fields |
134 | 134 | $releaseMethods = []; |
135 | - if (!empty($branches)) { |
|
135 | + if(!empty($branches)) { |
|
136 | 136 | $releaseMethods[] = new SelectionGroup_Item( |
137 | 137 | 'Branch', |
138 | 138 | new DropdownField('Branch', 'Select a branch', $branches), |
139 | 139 | 'Deploy the latest version of a branch' |
140 | 140 | ); |
141 | 141 | } |
142 | - if ($tags) { |
|
142 | + if($tags) { |
|
143 | 143 | $releaseMethods[] = new SelectionGroup_Item( |
144 | 144 | 'Tag', |
145 | 145 | new DropdownField('Tag', 'Select a tag', $tags), |
146 | 146 | 'Deploy a tagged release' |
147 | 147 | ); |
148 | 148 | } |
149 | - if ($redeploy) { |
|
149 | + if($redeploy) { |
|
150 | 150 | $releaseMethods[] = new SelectionGroup_Item( |
151 | 151 | 'Redeploy', |
152 | 152 | new GroupedDropdownField('Redeploy', 'Redeploy', $redeploy), |