Completed
Pull Request — master (#489)
by Helpful
03:51
created
code/backends/DeploymentStrategy.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -79,6 +79,7 @@  discard block
 block discarded – undo
79 79
     }
80 80
 
81 81
     /**
82
+     * @param string $code
82 83
      */
83 84
     public function setActionCode($code)
84 85
     {
@@ -95,6 +96,7 @@  discard block
 block discarded – undo
95 96
 
96 97
     /**
97 98
      * @param int
99
+     * @param string $seconds
98 100
      */
99 101
     public function setEstimatedTime($seconds)
100 102
     {
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class DeploymentStrategy extends ViewableData
4
-{
3
+class DeploymentStrategy extends ViewableData {
5 4
 
6 5
     const SUCCESS_CODE = 'success';
7 6
 
@@ -56,8 +55,7 @@  discard block
 block discarded – undo
56 55
      * @param DNEnvironment $environment
57 56
      * @param array $options
58 57
      */
59
-    public function __construct(DNEnvironment $environment, $options = array())
60
-    {
58
+    public function __construct(DNEnvironment $environment, $options = array()) {
61 59
         $this->environment = $environment;
62 60
         $this->options = $options;
63 61
     }
@@ -65,47 +63,41 @@  discard block
 block discarded – undo
65 63
     /**
66 64
      * @param string $title
67 65
      */
68
-    public function setActionTitle($title)
69
-    {
66
+    public function setActionTitle($title) {
70 67
         $this->actionTitle = $title;
71 68
     }
72 69
 
73 70
     /**
74 71
      * @return string
75 72
      */
76
-    public function getActionTitle()
77
-    {
73
+    public function getActionTitle() {
78 74
         return $this->actionTitle;
79 75
     }
80 76
 
81 77
     /**
82 78
      */
83
-    public function setActionCode($code)
84
-    {
79
+    public function setActionCode($code) {
85 80
         $this->actionCode = $code;
86 81
     }
87 82
 
88 83
     /**
89 84
      * @return string
90 85
      */
91
-    public function getActionCode()
92
-    {
86
+    public function getActionCode() {
93 87
         return $this->actionCode;
94 88
     }
95 89
 
96 90
     /**
97 91
      * @param int
98 92
      */
99
-    public function setEstimatedTime($seconds)
100
-    {
93
+    public function setEstimatedTime($seconds) {
101 94
         $this->estimatedTime = $seconds;
102 95
     }
103 96
 
104 97
     /**
105 98
      * @return int Time in minutes
106 99
      */
107
-    public function getEstimatedTime()
108
-    {
100
+    public function getEstimatedTime() {
109 101
         return $this->estimatedTime;
110 102
     }
111 103
 
@@ -114,8 +106,7 @@  discard block
 block discarded – undo
114 106
      * @param string $from
115 107
      * @param string $to
116 108
      */
117
-    public function setChange($title, $from, $to)
118
-    {
109
+    public function setChange($title, $from, $to) {
119 110
         return $this->changes[$title] = array(
120 111
             'from' => $from,
121 112
             'to' => $to
@@ -126,8 +117,7 @@  discard block
 block discarded – undo
126 117
      * @param string $title
127 118
      * @param string $desc
128 119
      */
129
-    public function setChangeDescriptionOnly($title, $desc)
130
-    {
120
+    public function setChangeDescriptionOnly($title, $desc) {
131 121
         return $this->changes[$title] = array(
132 122
             'description' => $desc
133 123
         );
@@ -138,8 +128,7 @@  discard block
 block discarded – undo
138 128
      *
139 129
      * @return array
140 130
      */
141
-    public function getChangesModificationNeeded()
142
-    {
131
+    public function getChangesModificationNeeded() {
143 132
         $filtered = [];
144 133
         foreach ($this->changes as $change => $details) {
145 134
             if (array_key_exists('description', $details)) {
@@ -164,8 +153,7 @@  discard block
 block discarded – undo
164 153
      *		)
165 154
      *	)
166 155
      */
167
-    public function getChanges()
168
-    {
156
+    public function getChanges() {
169 157
         return $this->changes;
170 158
     }
171 159
 
@@ -174,8 +162,7 @@  discard block
 block discarded – undo
174 162
      *
175 163
      * @return ArrayData|null
176 164
      */
177
-    public function getChange($key)
178
-    {
165
+    public function getChange($key) {
179 166
         $changes = $this->getChanges();
180 167
         if (array_key_exists($key, $changes)) {
181 168
             return new ArrayData($changes[$key]);
@@ -187,8 +174,7 @@  discard block
 block discarded – undo
187 174
      * @param string $option
188 175
      * @param string $value
189 176
      */
190
-    public function setOption($option, $value)
191
-    {
177
+    public function setOption($option, $value) {
192 178
         $this->options[$option] = $value;
193 179
     }
194 180
 
@@ -196,8 +182,7 @@  discard block
 block discarded – undo
196 182
      * @param string $option
197 183
      * @return string|null
198 184
      */
199
-    public function getOption($option)
200
-    {
185
+    public function getOption($option) {
201 186
         if (!empty($this->options[$option])) {
202 187
             return $this->options[$option];
203 188
         }
@@ -206,32 +191,28 @@  discard block
 block discarded – undo
206 191
     /**
207 192
      * @return string
208 193
      */
209
-    public function getOptions()
210
-    {
194
+    public function getOptions() {
211 195
         return $this->options;
212 196
     }
213 197
 
214 198
     /**
215 199
      * @param string $code
216 200
      */
217
-    public function setValidationCode($code)
218
-    {
201
+    public function setValidationCode($code) {
219 202
         $this->validationCode = $code;
220 203
     }
221 204
 
222 205
     /**
223 206
      * @return string
224 207
      */
225
-    public function getValidationCode()
226
-    {
208
+    public function getValidationCode() {
227 209
         return $this->validationCode;
228 210
     }
229 211
 
230 212
     /**
231 213
      * @param string $msg
232 214
      */
233
-    public function setMessage($msg, $code = self::ERROR_CODE)
234
-    {
215
+    public function setMessage($msg, $code = self::ERROR_CODE) {
235 216
         $this->messages[] = [
236 217
             'text' => $msg,
237 218
             'code' => $code
@@ -251,8 +232,7 @@  discard block
 block discarded – undo
251 232
     /**
252 233
      * @return array
253 234
      */
254
-    public function getMessages()
255
-    {
235
+    public function getMessages() {
256 236
         return $this->messages;
257 237
     }
258 238
 
@@ -261,8 +241,7 @@  discard block
 block discarded – undo
261 241
      *
262 242
      * @return array
263 243
      */
264
-    public function toArray()
265
-    {
244
+    public function toArray() {
266 245
         $fields = array(
267 246
             'actionTitle',
268 247
             'actionCode',
@@ -283,8 +262,7 @@  discard block
 block discarded – undo
283 262
     /**
284 263
      * @return string
285 264
      */
286
-    public function toJSON()
287
-    {
265
+    public function toJSON() {
288 266
         return json_encode($this->toArray(), JSON_PRETTY_PRINT);
289 267
     }
290 268
 
@@ -294,8 +272,7 @@  discard block
 block discarded – undo
294 272
      *
295 273
      * @param string $json
296 274
      */
297
-    public function fromJSON($json)
298
-    {
275
+    public function fromJSON($json) {
299 276
         $decoded = json_decode($json, true);
300 277
         return $this->fromArray($decoded);
301 278
     }
@@ -306,8 +283,7 @@  discard block
 block discarded – undo
306 283
      *
307 284
      * @param string $data
308 285
      */
309
-    public function fromArray($data)
310
-    {
286
+    public function fromArray($data) {
311 287
         $fields = array(
312 288
             'actionTitle',
313 289
             'actionCode',
@@ -328,8 +304,7 @@  discard block
 block discarded – undo
328 304
     /**
329 305
      * @return DNDeployment
330 306
      */
331
-    public function createDeployment()
332
-    {
307
+    public function createDeployment() {
333 308
         $deployment = DNDeployment::create();
334 309
         $deployment->EnvironmentID = $this->environment->ID;
335 310
         // Pull out the SHA from the options so we can make it queryable.
Please login to merge, or discard this patch.
code/control/DNRoot.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
      * @param array $data
998 998
      * @param Form $form
999 999
      *
1000
-     * @return bool|HTMLText|SS_HTTPResponse
1000
+     * @return SS_HTTPResponse|null
1001 1001
      */
1002 1002
     public function doCreateEnvironment($data, Form $form)
1003 1003
     {
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
     /**
2431 2431
      * Create project action.
2432 2432
      *
2433
-     * @return SS_HTTPResponse
2433
+     * @return HTMLText
2434 2434
      */
2435 2435
     public function createproject(SS_HTTPRequest $request)
2436 2436
     {
Please login to merge, or discard this patch.
Braces   +84 added lines, -168 removed lines patch added patch discarded remove patch
@@ -170,8 +170,7 @@  discard block
 block discarded – undo
170 170
     /**
171 171
      * Include requirements that deploynaut needs, such as javascript.
172 172
      */
173
-    public static function include_requirements()
174
-    {
173
+    public static function include_requirements() {
175 174
 
176 175
         // JS should always go to the bottom, otherwise there's the risk that Requirements
177 176
         // puts them halfway through the page to the nearest <script> tag. We don't want that.
@@ -209,8 +208,7 @@  discard block
 block discarded – undo
209 208
      *
210 209
      * @return boolean
211 210
      */
212
-    public static function FlagSnapshotsEnabled()
213
-    {
211
+    public static function FlagSnapshotsEnabled() {
214 212
         if (defined('FLAG_SNAPSHOTS_ENABLED') && FLAG_SNAPSHOTS_ENABLED) {
215 213
             return true;
216 214
         }
@@ -227,8 +225,7 @@  discard block
 block discarded – undo
227 225
     /**
228 226
      * @return ArrayList
229 227
      */
230
-    public static function get_support_links()
231
-    {
228
+    public static function get_support_links() {
232 229
         $supportLinks = self::config()->support_links;
233 230
         if ($supportLinks) {
234 231
             return new ArrayList($supportLinks);
@@ -238,8 +235,7 @@  discard block
 block discarded – undo
238 235
     /**
239 236
      * @return array
240 237
      */
241
-    public static function get_template_global_variables()
242
-    {
238
+    public static function get_template_global_variables() {
243 239
         return array(
244 240
             'RedisUnavailable' => 'RedisUnavailable',
245 241
             'RedisWorkersCount' => 'RedisWorkersCount',
@@ -250,8 +246,7 @@  discard block
 block discarded – undo
250 246
 
251 247
     /**
252 248
      */
253
-    public function init()
254
-    {
249
+    public function init() {
255 250
         parent::init();
256 251
 
257 252
         if (!Member::currentUser() && !Session::get('AutoLoginHash')) {
@@ -267,8 +262,7 @@  discard block
 block discarded – undo
267 262
     /**
268 263
      * @return string
269 264
      */
270
-    public function Link()
271
-    {
265
+    public function Link() {
272 266
         return "naut/";
273 267
     }
274 268
 
@@ -278,8 +272,7 @@  discard block
 block discarded – undo
278 272
      * @param SS_HTTPRequest $request
279 273
      * @return \SS_HTTPResponse
280 274
      */
281
-    public function index(SS_HTTPRequest $request)
282
-    {
275
+    public function index(SS_HTTPRequest $request) {
283 276
         return $this->redirect($this->Link() . 'projects/');
284 277
     }
285 278
 
@@ -289,8 +282,7 @@  discard block
 block discarded – undo
289 282
      * @param SS_HTTPRequest $request
290 283
      * @return string - HTML
291 284
      */
292
-    public function projects(SS_HTTPRequest $request)
293
-    {
285
+    public function projects(SS_HTTPRequest $request) {
294 286
         // Performs canView permission check by limiting visible projects in DNProjectsList() call.
295 287
         return $this->customise(array(
296 288
             'Title' => 'Projects',
@@ -301,8 +293,7 @@  discard block
 block discarded – undo
301 293
      * @param SS_HTTPRequest $request
302 294
      * @return HTMLText
303 295
      */
304
-    public function nav(SS_HTTPRequest $request)
305
-    {
296
+    public function nav(SS_HTTPRequest $request) {
306 297
         return $this->renderWith('Nav');
307 298
     }
308 299
 
@@ -310,8 +301,7 @@  discard block
 block discarded – undo
310 301
      * Return a link to the navigation template used for AJAX requests.
311 302
      * @return string
312 303
      */
313
-    public function NavLink()
314
-    {
304
+    public function NavLink() {
315 305
         $currentProject = $this->getCurrentProject();
316 306
         $projectName = $currentProject ? $currentProject->Name : null;
317 307
         return Controller::join_links(Director::absoluteBaseURL(), 'naut', 'nav', $projectName);
@@ -323,8 +313,7 @@  discard block
 block discarded – undo
323 313
      * @param SS_HTTPRequest $request
324 314
      * @return SS_HTTPResponse - HTML
325 315
      */
326
-    public function snapshots(SS_HTTPRequest $request)
327
-    {
316
+    public function snapshots(SS_HTTPRequest $request) {
328 317
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
329 318
         return $this->getCustomisedViewSection('SnapshotsSection', 'Data Snapshots');
330 319
     }
@@ -335,8 +324,7 @@  discard block
 block discarded – undo
335 324
      * @param SS_HTTPRequest $request
336 325
      * @return string - HTML
337 326
      */
338
-    public function createsnapshot(SS_HTTPRequest $request)
339
-    {
327
+    public function createsnapshot(SS_HTTPRequest $request) {
340 328
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
341 329
 
342 330
         // Performs canView permission check by limiting visible projects
@@ -362,8 +350,7 @@  discard block
 block discarded – undo
362 350
      * @param SS_HTTPRequest $request
363 351
      * @return string - HTML
364 352
      */
365
-    public function uploadsnapshot(SS_HTTPRequest $request)
366
-    {
353
+    public function uploadsnapshot(SS_HTTPRequest $request) {
367 354
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
368 355
 
369 356
         // Performs canView permission check by limiting visible projects
@@ -387,8 +374,7 @@  discard block
 block discarded – undo
387 374
      * Return the upload limit for snapshot uploads
388 375
      * @return string
389 376
      */
390
-    public function UploadLimit()
391
-    {
377
+    public function UploadLimit() {
392 378
         return File::format_size(min(
393 379
             File::ini2bytes(ini_get('upload_max_filesize')),
394 380
             File::ini2bytes(ini_get('post_max_size'))
@@ -401,8 +387,7 @@  discard block
 block discarded – undo
401 387
      * @param SS_HTTPRequest $request
402 388
      * @return Form
403 389
      */
404
-    public function getUploadSnapshotForm(SS_HTTPRequest $request)
405
-    {
390
+    public function getUploadSnapshotForm(SS_HTTPRequest $request) {
406 391
         // Performs canView permission check by limiting visible projects
407 392
         $project = $this->getCurrentProject();
408 393
         if (!$project) {
@@ -459,8 +444,7 @@  discard block
 block discarded – undo
459 444
      *
460 445
      * @return bool|HTMLText|SS_HTTPResponse
461 446
      */
462
-    public function doUploadSnapshot($data, Form $form)
463
-    {
447
+    public function doUploadSnapshot($data, Form $form) {
464 448
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
465 449
 
466 450
         // Performs canView permission check by limiting visible projects
@@ -559,8 +543,7 @@  discard block
 block discarded – undo
559 543
      * @param SS_HTTPRequest $request
560 544
      * @return Form
561 545
      */
562
-    public function getPostSnapshotForm(SS_HTTPRequest $request)
563
-    {
546
+    public function getPostSnapshotForm(SS_HTTPRequest $request) {
564 547
         // Performs canView permission check by limiting visible projects
565 548
         $project = $this->getCurrentProject();
566 549
         if (!$project) {
@@ -611,8 +594,7 @@  discard block
 block discarded – undo
611 594
      *
612 595
      * @return SS_HTTPResponse
613 596
      */
614
-    public function doPostSnapshot($data, $form)
615
-    {
597
+    public function doPostSnapshot($data, $form) {
616 598
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
617 599
 
618 600
         $project = $this->getCurrentProject();
@@ -649,8 +631,7 @@  discard block
 block discarded – undo
649 631
      * @param SS_HTTPRequest $request
650 632
      * @return SS_HTTPResponse - HTML
651 633
      */
652
-    public function snapshotslog(SS_HTTPRequest $request)
653
-    {
634
+    public function snapshotslog(SS_HTTPRequest $request) {
654 635
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
655 636
         return $this->getCustomisedViewSection('SnapshotsSection', 'Data Snapshots Log');
656 637
     }
@@ -660,8 +641,7 @@  discard block
 block discarded – undo
660 641
      * @return SS_HTTPResponse|string
661 642
      * @throws SS_HTTPResponse_Exception
662 643
      */
663
-    public function postsnapshotsuccess(SS_HTTPRequest $request)
664
-    {
644
+    public function postsnapshotsuccess(SS_HTTPRequest $request) {
665 645
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
666 646
 
667 647
         // Performs canView permission check by limiting visible projects
@@ -695,8 +675,7 @@  discard block
 block discarded – undo
695 675
      * @param SS_HTTPRequest $request
696 676
      * @return \SS_HTTPResponse
697 677
      */
698
-    public function project(SS_HTTPRequest $request)
699
-    {
678
+    public function project(SS_HTTPRequest $request) {
700 679
         return $this->getCustomisedViewSection('ProjectOverview', '', array('IsAdmin' => Permission::check('ADMIN')));
701 680
     }
702 681
 
@@ -707,8 +686,7 @@  discard block
 block discarded – undo
707 686
      *
708 687
      * @return SS_HTTPResponse
709 688
      */
710
-    public function toggleprojectstar(SS_HTTPRequest $request)
711
-    {
689
+    public function toggleprojectstar(SS_HTTPRequest $request) {
712 690
         $project = $this->getCurrentProject();
713 691
         if (!$project) {
714 692
             return $this->project404Response();
@@ -734,8 +712,7 @@  discard block
 block discarded – undo
734 712
      * @param SS_HTTPRequest $request
735 713
      * @return \SS_HTTPResponse
736 714
      */
737
-    public function branch(SS_HTTPRequest $request)
738
-    {
715
+    public function branch(SS_HTTPRequest $request) {
739 716
         $project = $this->getCurrentProject();
740 717
         if (!$project) {
741 718
             return $this->project404Response();
@@ -756,8 +733,7 @@  discard block
 block discarded – undo
756 733
      * @param SS_HTTPRequest $request
757 734
      * @return \SS_HTTPResponse
758 735
      */
759
-    public function environment(SS_HTTPRequest $request)
760
-    {
736
+    public function environment(SS_HTTPRequest $request) {
761 737
         // Performs canView permission check by limiting visible projects
762 738
         $project = $this->getCurrentProject();
763 739
         if (!$project) {
@@ -785,8 +761,7 @@  discard block
 block discarded – undo
785 761
      *
786 762
      * @return SS_HTTPResponse
787 763
      */
788
-    public function doDryRun($data, DeployForm $form)
789
-    {
764
+    public function doDryRun($data, DeployForm $form) {
790 765
         return $this->beginPipeline($data, $form, true);
791 766
     }
792 767
 
@@ -797,8 +772,7 @@  discard block
 block discarded – undo
797 772
      * @param DeployForm $form
798 773
      * @return \SS_HTTPResponse
799 774
      */
800
-    public function startPipeline($data, $form)
801
-    {
775
+    public function startPipeline($data, $form) {
802 776
         return $this->beginPipeline($data, $form);
803 777
     }
804 778
 
@@ -810,8 +784,7 @@  discard block
 block discarded – undo
810 784
      * @param bool $isDryRun
811 785
      * @return \SS_HTTPResponse
812 786
      */
813
-    protected function beginPipeline($data, DeployForm $form, $isDryRun = false)
814
-    {
787
+    protected function beginPipeline($data, DeployForm $form, $isDryRun = false) {
815 788
         $buildName = $form->getSelectedBuild($data);
816 789
 
817 790
         // Performs canView permission check by limiting visible projects
@@ -851,8 +824,7 @@  discard block
 block discarded – undo
851 824
      * @return SS_HTTPResponse
852 825
      * @throws SS_HTTPResponse_Exception
853 826
      */
854
-    public function pipeline(SS_HTTPRequest $request)
855
-    {
827
+    public function pipeline(SS_HTTPRequest $request) {
856 828
         $params = $request->params();
857 829
         $pipeline = Pipeline::get()->byID($params['Identifier']);
858 830
 
@@ -883,8 +855,7 @@  discard block
 block discarded – undo
883 855
      * @param SS_HTTPRequest $request
884 856
      * @return string
885 857
      */
886
-    public function createenv(SS_HTTPRequest $request)
887
-    {
858
+    public function createenv(SS_HTTPRequest $request) {
888 859
         $params = $request->params();
889 860
         if ($params['Identifier']) {
890 861
             $record = DNCreateEnvironment::get()->byId($params['Identifier']);
@@ -913,8 +884,7 @@  discard block
 block discarded – undo
913 884
     }
914 885
 
915 886
 
916
-    public function createenvlog(SS_HTTPRequest $request)
917
-    {
887
+    public function createenvlog(SS_HTTPRequest $request) {
918 888
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
919 889
 
920 890
         $params = $request->params();
@@ -947,8 +917,7 @@  discard block
 block discarded – undo
947 917
      * @param SS_HTTPRequest $request
948 918
      * @return Form
949 919
      */
950
-    public function getCreateEnvironmentForm(SS_HTTPRequest $request)
951
-    {
920
+    public function getCreateEnvironmentForm(SS_HTTPRequest $request) {
952 921
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
953 922
 
954 923
         $project = $this->getCurrentProject();
@@ -999,8 +968,7 @@  discard block
 block discarded – undo
999 968
      *
1000 969
      * @return bool|HTMLText|SS_HTTPResponse
1001 970
      */
1002
-    public function doCreateEnvironment($data, Form $form)
1003
-    {
971
+    public function doCreateEnvironment($data, Form $form) {
1004 972
         $this->setCurrentActionType(self::ACTION_ENVIRONMENTS);
1005 973
 
1006 974
         $project = $this->getCurrentProject();
@@ -1030,8 +998,7 @@  discard block
 block discarded – undo
1030 998
      * @param SS_HTTPRequest $request
1031 999
      * @return \SS_HTTPResponse
1032 1000
      */
1033
-    public function metrics(SS_HTTPRequest $request)
1034
-    {
1001
+    public function metrics(SS_HTTPRequest $request) {
1035 1002
         // Performs canView permission check by limiting visible projects
1036 1003
         $project = $this->getCurrentProject();
1037 1004
         if (!$project) {
@@ -1052,8 +1019,7 @@  discard block
 block discarded – undo
1052 1019
      *
1053 1020
      * @return DNData
1054 1021
      */
1055
-    public function DNData()
1056
-    {
1022
+    public function DNData() {
1057 1023
         return DNData::inst();
1058 1024
     }
1059 1025
 
@@ -1062,8 +1028,7 @@  discard block
 block discarded – undo
1062 1028
      *
1063 1029
      * @return SS_List
1064 1030
      */
1065
-    public function DNProjectList()
1066
-    {
1031
+    public function DNProjectList() {
1067 1032
         $memberId = Member::currentUserID();
1068 1033
         if (!$memberId) {
1069 1034
             return new ArrayList();
@@ -1081,8 +1046,7 @@  discard block
 block discarded – undo
1081 1046
     /**
1082 1047
      * @return ArrayList
1083 1048
      */
1084
-    public function getPlatformSpecificStrings()
1085
-    {
1049
+    public function getPlatformSpecificStrings() {
1086 1050
         $strings = $this->config()->platform_specific_strings;
1087 1051
         if ($strings) {
1088 1052
             return new ArrayList($strings);
@@ -1094,8 +1058,7 @@  discard block
 block discarded – undo
1094 1058
      *
1095 1059
      * @return SS_List
1096 1060
      */
1097
-    public function getStarredProjects()
1098
-    {
1061
+    public function getStarredProjects() {
1099 1062
         $member = Member::currentUser();
1100 1063
         if ($member === null) {
1101 1064
             return new ArrayList();
@@ -1119,8 +1082,7 @@  discard block
 block discarded – undo
1119 1082
      *
1120 1083
      * @return ArrayList
1121 1084
      */
1122
-    public function Navigation($limit = 5)
1123
-    {
1085
+    public function Navigation($limit = 5) {
1124 1086
         $navigation = new ArrayList();
1125 1087
 
1126 1088
         $currentProject = $this->getCurrentProject();
@@ -1173,8 +1135,7 @@  discard block
 block discarded – undo
1173 1135
      *
1174 1136
      * @return Form
1175 1137
      */
1176
-    public function getDeployForm($request = null)
1177
-    {
1138
+    public function getDeployForm($request = null) {
1178 1139
 
1179 1140
         // Performs canView permission check by limiting visible projects
1180 1141
         $project = $this->getCurrentProject();
@@ -1220,8 +1181,7 @@  discard block
 block discarded – undo
1220 1181
      *
1221 1182
      * @return SS_HTTPResponse|string
1222 1183
      */
1223
-    public function gitRevisions(SS_HTTPRequest $request)
1224
-    {
1184
+    public function gitRevisions(SS_HTTPRequest $request) {
1225 1185
 
1226 1186
         // Performs canView permission check by limiting visible projects
1227 1187
         $project = $this->getCurrentProject();
@@ -1372,8 +1332,7 @@  discard block
 block discarded – undo
1372 1332
      *
1373 1333
      * @return bool
1374 1334
      */
1375
-    protected function checkCsrfToken(SS_HTTPRequest $request, $resetToken = true)
1376
-    {
1335
+    protected function checkCsrfToken(SS_HTTPRequest $request, $resetToken = true) {
1377 1336
         $token = SecurityToken::inst();
1378 1337
 
1379 1338
         // Ensure the submitted token has a value
@@ -1399,8 +1358,7 @@  discard block
 block discarded – undo
1399 1358
      *
1400 1359
      * @return string
1401 1360
      */
1402
-    public function deploySummary(SS_HTTPRequest $request)
1403
-    {
1361
+    public function deploySummary(SS_HTTPRequest $request) {
1404 1362
 
1405 1363
         // Performs canView permission check by limiting visible projects
1406 1364
         $project = $this->getCurrentProject();
@@ -1458,8 +1416,7 @@  discard block
 block discarded – undo
1458 1416
      * @throws ValidationException
1459 1417
      * @throws null
1460 1418
      */
1461
-    public function startDeploy(SS_HTTPRequest $request)
1462
-    {
1419
+    public function startDeploy(SS_HTTPRequest $request) {
1463 1420
 
1464 1421
         // Ensure the CSRF Token is correct
1465 1422
         if (!$this->checkCsrfToken($request)) {
@@ -1502,8 +1459,7 @@  discard block
 block discarded – undo
1502 1459
      * @return SS_HTTPResponse|string
1503 1460
      * @throws SS_HTTPResponse_Exception
1504 1461
      */
1505
-    public function deploy(SS_HTTPRequest $request)
1506
-    {
1462
+    public function deploy(SS_HTTPRequest $request) {
1507 1463
         $params = $request->params();
1508 1464
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1509 1465
 
@@ -1538,8 +1494,7 @@  discard block
 block discarded – undo
1538 1494
      * @return string
1539 1495
      * @throws SS_HTTPResponse_Exception
1540 1496
      */
1541
-    public function deploylog(SS_HTTPRequest $request)
1542
-    {
1497
+    public function deploylog(SS_HTTPRequest $request) {
1543 1498
         $params = $request->params();
1544 1499
         $deployment = DNDeployment::get()->byId($params['Identifier']);
1545 1500
 
@@ -1575,8 +1530,7 @@  discard block
 block discarded – undo
1575 1530
      *
1576 1531
      * @return Form
1577 1532
      */
1578
-    public function getDataTransferForm(SS_HTTPRequest $request = null)
1579
-    {
1533
+    public function getDataTransferForm(SS_HTTPRequest $request = null) {
1580 1534
         // Performs canView permission check by limiting visible projects
1581 1535
         $envs = $this->getCurrentProject()->DNEnvironmentList()->filterByCallback(function ($item) {
1582 1536
             return $item->canBackup();
@@ -1612,8 +1566,7 @@  discard block
 block discarded – undo
1612 1566
      * @return SS_HTTPResponse
1613 1567
      * @throws SS_HTTPResponse_Exception
1614 1568
      */
1615
-    public function doDataTransfer($data, Form $form)
1616
-    {
1569
+    public function doDataTransfer($data, Form $form) {
1617 1570
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1618 1571
 
1619 1572
         // Performs canView permission check by limiting visible projects
@@ -1686,8 +1639,7 @@  discard block
 block discarded – undo
1686 1639
      * @return SS_HTTPResponse|string
1687 1640
      * @throws SS_HTTPResponse_Exception
1688 1641
      */
1689
-    public function transfer(SS_HTTPRequest $request)
1690
-    {
1642
+    public function transfer(SS_HTTPRequest $request) {
1691 1643
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1692 1644
 
1693 1645
         $params = $request->params();
@@ -1721,8 +1673,7 @@  discard block
 block discarded – undo
1721 1673
      * @return string
1722 1674
      * @throws SS_HTTPResponse_Exception
1723 1675
      */
1724
-    public function transferlog(SS_HTTPRequest $request)
1725
-    {
1676
+    public function transferlog(SS_HTTPRequest $request) {
1726 1677
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1727 1678
 
1728 1679
         $params = $request->params();
@@ -1761,8 +1712,7 @@  discard block
 block discarded – undo
1761 1712
      *                            otherwise the state is inferred from the request data.
1762 1713
      * @return Form
1763 1714
      */
1764
-    public function getDataTransferRestoreForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1765
-    {
1715
+    public function getDataTransferRestoreForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1766 1716
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1767 1717
 
1768 1718
         // Performs canView permission check by limiting visible projects
@@ -1821,8 +1771,7 @@  discard block
 block discarded – undo
1821 1771
      * @return HTMLText
1822 1772
      * @throws SS_HTTPResponse_Exception
1823 1773
      */
1824
-    public function restoresnapshot(SS_HTTPRequest $request)
1825
-    {
1774
+    public function restoresnapshot(SS_HTTPRequest $request) {
1826 1775
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1827 1776
 
1828 1777
         /** @var DNDataArchive $dataArchive */
@@ -1854,8 +1803,7 @@  discard block
 block discarded – undo
1854 1803
      * @return HTMLText
1855 1804
      * @throws SS_HTTPResponse_Exception
1856 1805
      */
1857
-    public function deletesnapshot(SS_HTTPRequest $request)
1858
-    {
1806
+    public function deletesnapshot(SS_HTTPRequest $request) {
1859 1807
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1860 1808
 
1861 1809
         /** @var DNDataArchive $dataArchive */
@@ -1881,8 +1829,7 @@  discard block
 block discarded – undo
1881 1829
      *        from the request data.
1882 1830
      * @return Form
1883 1831
      */
1884
-    public function getDeleteForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1885
-    {
1832
+    public function getDeleteForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1886 1833
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1887 1834
 
1888 1835
         // Performs canView permission check by limiting visible projects
@@ -1919,8 +1866,7 @@  discard block
 block discarded – undo
1919 1866
      * @return bool|SS_HTTPResponse
1920 1867
      * @throws SS_HTTPResponse_Exception
1921 1868
      */
1922
-    public function doDelete($data, Form $form)
1923
-    {
1869
+    public function doDelete($data, Form $form) {
1924 1870
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1925 1871
 
1926 1872
         // Performs canView permission check by limiting visible projects
@@ -1959,8 +1905,7 @@  discard block
 block discarded – undo
1959 1905
      * @return HTMLText
1960 1906
      * @throws SS_HTTPResponse_Exception
1961 1907
      */
1962
-    public function movesnapshot(SS_HTTPRequest $request)
1963
-    {
1908
+    public function movesnapshot(SS_HTTPRequest $request) {
1964 1909
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
1965 1910
 
1966 1911
         /** @var DNDataArchive $dataArchive */
@@ -1989,8 +1934,7 @@  discard block
 block discarded – undo
1989 1934
      *
1990 1935
      * @return Form|SS_HTTPResponse
1991 1936
      */
1992
-    public function getMoveForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null)
1993
-    {
1937
+    public function getMoveForm(SS_HTTPRequest $request, DNDataArchive $dataArchive = null) {
1994 1938
         $dataArchive = $dataArchive ? $dataArchive : DNDataArchive::get()->byId($request->requestVar('DataArchiveID'));
1995 1939
 
1996 1940
         $envs = $dataArchive->validTargetEnvironments();
@@ -2030,8 +1974,7 @@  discard block
 block discarded – undo
2030 1974
      * @throws ValidationException
2031 1975
      * @throws null
2032 1976
      */
2033
-    public function doMove($data, Form $form)
2034
-    {
1977
+    public function doMove($data, Form $form) {
2035 1978
         $this->setCurrentActionType(self::ACTION_SNAPSHOT);
2036 1979
 
2037 1980
         // Performs canView permission check by limiting visible projects
@@ -2069,8 +2012,7 @@  discard block
 block discarded – undo
2069 2012
      *
2070 2013
      * @return string
2071 2014
      */
2072
-    public static function RedisUnavailable()
2073
-    {
2015
+    public static function RedisUnavailable() {
2074 2016
         try {
2075 2017
             Resque::queues();
2076 2018
         } catch (Exception $e) {
@@ -2084,16 +2026,14 @@  discard block
 block discarded – undo
2084 2026
      *
2085 2027
      * @return int
2086 2028
      */
2087
-    public static function RedisWorkersCount()
2088
-    {
2029
+    public static function RedisWorkersCount() {
2089 2030
         return count(Resque_Worker::all());
2090 2031
     }
2091 2032
 
2092 2033
     /**
2093 2034
      * @return array
2094 2035
      */
2095
-    public function providePermissions()
2096
-    {
2036
+    public function providePermissions() {
2097 2037
         return array(
2098 2038
             self::DEPLOYNAUT_BYPASS_PIPELINE => array(
2099 2039
                 'name' => "Bypass Pipeline",
@@ -2137,8 +2077,7 @@  discard block
 block discarded – undo
2137 2077
     /**
2138 2078
      * @return DNProject|null
2139 2079
      */
2140
-    public function getCurrentProject()
2141
-    {
2080
+    public function getCurrentProject() {
2142 2081
         $projectName = trim($this->getRequest()->param('Project'));
2143 2082
         if (!$projectName) {
2144 2083
             return null;
@@ -2153,8 +2092,7 @@  discard block
 block discarded – undo
2153 2092
      * @param DNProject|null $project
2154 2093
      * @return DNEnvironment|null
2155 2094
      */
2156
-    public function getCurrentEnvironment(DNProject $project = null)
2157
-    {
2095
+    public function getCurrentEnvironment(DNProject $project = null) {
2158 2096
         if ($this->getRequest()->param('Environment') === null) {
2159 2097
             return null;
2160 2098
         }
@@ -2177,8 +2115,7 @@  discard block
 block discarded – undo
2177 2115
      *
2178 2116
      * @return string - one of the consts from self::$action_types
2179 2117
      */
2180
-    public function getCurrentActionType()
2181
-    {
2118
+    public function getCurrentActionType() {
2182 2119
         return $this->actionType;
2183 2120
     }
2184 2121
 
@@ -2187,8 +2124,7 @@  discard block
 block discarded – undo
2187 2124
      *
2188 2125
      * @param string $actionType string - one of the consts from self::$action_types
2189 2126
      */
2190
-    public function setCurrentActionType($actionType)
2191
-    {
2127
+    public function setCurrentActionType($actionType) {
2192 2128
         $this->actionType = $actionType;
2193 2129
     }
2194 2130
 
@@ -2202,8 +2138,7 @@  discard block
 block discarded – undo
2202 2138
      * @param Member|null $member The {@link Member} to check (or null to check the currently logged in Member)
2203 2139
      * @return boolean|null true if $member has access to upload or download to at least one {@link DNEnvironment}.
2204 2140
      */
2205
-    public function CanViewArchives(Member $member = null)
2206
-    {
2141
+    public function CanViewArchives(Member $member = null) {
2207 2142
         if ($member === null) {
2208 2143
             $member = Member::currentUser();
2209 2144
         }
@@ -2239,8 +2174,7 @@  discard block
 block discarded – undo
2239 2174
      *
2240 2175
      * @return PaginatedList
2241 2176
      */
2242
-    public function CreateEnvironmentList()
2243
-    {
2177
+    public function CreateEnvironmentList() {
2244 2178
         $project = $this->getCurrentProject();
2245 2179
         if ($project) {
2246 2180
             return new PaginatedList($project->CreateEnvironments()->sort("Created DESC"), $this->request);
@@ -2253,8 +2187,7 @@  discard block
 block discarded – undo
2253 2187
      *
2254 2188
      * @return PaginatedList
2255 2189
      */
2256
-    public function CompleteDataArchives()
2257
-    {
2190
+    public function CompleteDataArchives() {
2258 2191
         $project = $this->getCurrentProject();
2259 2192
         $archives = new ArrayList();
2260 2193
 
@@ -2273,8 +2206,7 @@  discard block
 block discarded – undo
2273 2206
      * @return PaginatedList The list of "pending" data archives which are waiting for a file
2274 2207
      * to be delivered offline by post, and manually uploaded into the system.
2275 2208
      */
2276
-    public function PendingDataArchives()
2277
-    {
2209
+    public function PendingDataArchives() {
2278 2210
         $project = $this->getCurrentProject();
2279 2211
         $archives = new ArrayList();
2280 2212
         foreach ($project->DNEnvironmentList() as $env) {
@@ -2290,8 +2222,7 @@  discard block
 block discarded – undo
2290 2222
     /**
2291 2223
      * @return PaginatedList
2292 2224
      */
2293
-    public function DataTransferLogs()
2294
-    {
2225
+    public function DataTransferLogs() {
2295 2226
         $project = $this->getCurrentProject();
2296 2227
 
2297 2228
         $transfers = DNDataTransfer::get()->filterByCallback(function ($record) use ($project) {
@@ -2311,8 +2242,7 @@  discard block
 block discarded – undo
2311 2242
     /**
2312 2243
      * @return null|PaginatedList
2313 2244
      */
2314
-    public function DeployHistory()
2315
-    {
2245
+    public function DeployHistory() {
2316 2246
         if ($env = $this->getCurrentEnvironment()) {
2317 2247
             $history = $env->DeployHistory();
2318 2248
             if ($history->count() > 0) {
@@ -2327,8 +2257,7 @@  discard block
 block discarded – undo
2327 2257
     /**
2328 2258
      * @return SS_HTTPResponse
2329 2259
      */
2330
-    protected function project404Response()
2331
-    {
2260
+    protected function project404Response() {
2332 2261
         return new SS_HTTPResponse(
2333 2262
             "Project '" . Convert::raw2xml($this->getRequest()->param('Project')) . "' not found.",
2334 2263
             404
@@ -2338,8 +2267,7 @@  discard block
 block discarded – undo
2338 2267
     /**
2339 2268
      * @return SS_HTTPResponse
2340 2269
      */
2341
-    protected function environment404Response()
2342
-    {
2270
+    protected function environment404Response() {
2343 2271
         $envName = Convert::raw2xml($this->getRequest()->param('Environment'));
2344 2272
         return new SS_HTTPResponse("Environment '" . $envName . "' not found.", 404);
2345 2273
     }
@@ -2350,8 +2278,7 @@  discard block
 block discarded – undo
2350 2278
      *
2351 2279
      * @return string
2352 2280
      */
2353
-    protected function sendResponse($status, $content)
2354
-    {
2281
+    protected function sendResponse($status, $content) {
2355 2282
         // strip excessive newlines
2356 2283
         $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content);
2357 2284
 
@@ -2374,8 +2301,7 @@  discard block
 block discarded – undo
2374 2301
      *
2375 2302
      * @param string $mode
2376 2303
      */
2377
-    protected function validateSnapshotMode($mode)
2378
-    {
2304
+    protected function validateSnapshotMode($mode) {
2379 2305
         if (!in_array($mode, array('all', 'assets', 'db'))) {
2380 2306
             throw new LogicException('Invalid mode');
2381 2307
         }
@@ -2387,8 +2313,7 @@  discard block
 block discarded – undo
2387 2313
      *
2388 2314
      * @return SS_HTTPResponse
2389 2315
      */
2390
-    protected function getCustomisedViewSection($sectionName, $title = '', $data = array())
2391
-    {
2316
+    protected function getCustomisedViewSection($sectionName, $title = '', $data = array()) {
2392 2317
         // Performs canView permission check by limiting visible projects
2393 2318
         $project = $this->getCurrentProject();
2394 2319
         if (!$project) {
@@ -2408,8 +2333,7 @@  discard block
 block discarded – undo
2408 2333
      *
2409 2334
      * @return ArrayList
2410 2335
      */
2411
-    public function AmbientMenu()
2412
-    {
2336
+    public function AmbientMenu() {
2413 2337
         $list = new ArrayList();
2414 2338
 
2415 2339
         if (Member::currentUserID()) {
@@ -2432,8 +2356,7 @@  discard block
 block discarded – undo
2432 2356
      *
2433 2357
      * @return SS_HTTPResponse
2434 2358
      */
2435
-    public function createproject(SS_HTTPRequest $request)
2436
-    {
2359
+    public function createproject(SS_HTTPRequest $request) {
2437 2360
         if ($this->canCreateProjects()) {
2438 2361
             return $this->render(['CurrentTitle' => 'Create Stack']);
2439 2362
         }
@@ -2445,8 +2368,7 @@  discard block
 block discarded – undo
2445 2368
      *
2446 2369
      * @return bool
2447 2370
      */
2448
-    public function canCreateProjects($member = null)
2449
-    {
2371
+    public function canCreateProjects($member = null) {
2450 2372
         if (!$member) {
2451 2373
             $member = Member::currentUser();
2452 2374
         }
@@ -2460,8 +2382,7 @@  discard block
 block discarded – undo
2460 2382
     /**
2461 2383
      * @return Form
2462 2384
      */
2463
-    public function CreateProjectForm()
2464
-    {
2385
+    public function CreateProjectForm() {
2465 2386
         $form = Form::create(
2466 2387
             $this,
2467 2388
             __FUNCTION__,
@@ -2476,8 +2397,7 @@  discard block
 block discarded – undo
2476 2397
     /**
2477 2398
      * @return FieldList
2478 2399
      */
2479
-    protected function getCreateProjectFormFields()
2480
-    {
2400
+    protected function getCreateProjectFormFields() {
2481 2401
         $fields = FieldList::create();
2482 2402
         $fields->merge([
2483 2403
             TextField::create('Name', 'Title')->setDescription('Limited to alphanumeric characters, underscores and hyphens.'),
@@ -2490,8 +2410,7 @@  discard block
 block discarded – undo
2490 2410
     /**
2491 2411
      * @return FieldList
2492 2412
      */
2493
-    protected function getCreateProjectFormActions()
2494
-    {
2413
+    protected function getCreateProjectFormActions() {
2495 2414
         $fields = FieldList::create(
2496 2415
             FormAction::create('doCreateProject', 'Create Stack')
2497 2416
         );
@@ -2507,8 +2426,7 @@  discard block
 block discarded – undo
2507 2426
      *
2508 2427
      * @return SS_HTTPResponse
2509 2428
      */
2510
-    public function doCreateProject($data, $form)
2511
-    {
2429
+    public function doCreateProject($data, $form) {
2512 2430
         $form->loadDataFrom($data);
2513 2431
         $project = DNProject::create();
2514 2432
 
@@ -2540,8 +2458,7 @@  discard block
 block discarded – undo
2540 2458
      *
2541 2459
      * @return SS_HTTPResponse
2542 2460
      */
2543
-    public function createprojectprogress(SS_HTTPRequest $request)
2544
-    {
2461
+    public function createprojectprogress(SS_HTTPRequest $request) {
2545 2462
         $project = $this->getCurrentProject();
2546 2463
         if (!$project) {
2547 2464
             return $this->httpError(404);
@@ -2591,8 +2508,7 @@  discard block
 block discarded – undo
2591 2508
         return $response;
2592 2509
     }
2593 2510
 
2594
-    public function checkrepoaccess(SS_HTTPRequest $request)
2595
-    {
2511
+    public function checkrepoaccess(SS_HTTPRequest $request) {
2596 2512
         $project = $this->getCurrentProject();
2597 2513
         if (!$project) {
2598 2514
             return $this->httpError(404);
Please login to merge, or discard this patch.
code/api/DeploynautAPI.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  * DeploynautAPI > APIProject > APIEnvironment
14 14
  *
15 15
  */
16
-class DeploynautAPI extends APINoun
17
-{
16
+class DeploynautAPI extends APINoun {
18 17
 
19 18
     /**
20 19
      * Default URL handlers - (Action)/(ID)//(OtherID)
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
      * @param SS_HTTPRequest $request
47 46
      * @return SS_HTTPResponse
48 47
      */
49
-    public function listProjects(SS_HTTPRequest $request)
50
-    {
48
+    public function listProjects(SS_HTTPRequest $request) {
51 49
         $response = array(
52 50
             'href' => Director::absoluteURL($this->Link()),
53 51
             'projects' => array(),
@@ -75,8 +73,7 @@  discard block
 block discarded – undo
75 73
      * @param SS_HTTPRequest $request
76 74
      * @return APIProject
77 75
      */
78
-    public function project(SS_HTTPRequest $request)
79
-    {
76
+    public function project(SS_HTTPRequest $request) {
80 77
         $project = $this->getProject();
81 78
         if (!$project) {
82 79
             return $this->project404Response();
@@ -90,8 +87,7 @@  discard block
 block discarded – undo
90 87
      * @param SS_HTTPRequest $request
91 88
      * @return APIEnvironment
92 89
      */
93
-    public function environment(SS_HTTPRequest $request)
94
-    {
90
+    public function environment(SS_HTTPRequest $request) {
95 91
         $project = $this->getProject();
96 92
         if (!$project) {
97 93
             return $this->project404Response();
@@ -107,8 +103,7 @@  discard block
 block discarded – undo
107 103
     /**
108 104
      * @return SS_HTTPResponse
109 105
      */
110
-    protected function project404Response()
111
-    {
106
+    protected function project404Response() {
112 107
         $projectName = Convert::raw2xml($this->getRequest()->latestParam('Project'));
113 108
         return new SS_HTTPResponse('Project "' . $projectName . '" not found.', 404);
114 109
     }
@@ -116,8 +111,7 @@  discard block
 block discarded – undo
116 111
     /**
117 112
      * @return SS_HTTPResponse
118 113
      */
119
-    protected function environment404Response()
120
-    {
114
+    protected function environment404Response() {
121 115
         $envName = Convert::raw2xml($this->getRequest()->latestParam('Environment'));
122 116
         return new SS_HTTPResponse('Environment "' . $envName . '" not found.', 404);
123 117
     }
@@ -127,8 +121,7 @@  discard block
 block discarded – undo
127 121
      *
128 122
      * @return DNProject
129 123
      */
130
-    protected function getProject()
131
-    {
124
+    protected function getProject() {
132 125
         $projectName = $this->getRequest()->param('Project');
133 126
         return DNProject::get()->filter('Name', $projectName)->first();
134 127
     }
@@ -138,8 +131,7 @@  discard block
 block discarded – undo
138 131
      *
139 132
      * @return DNEnvironment
140 133
      */
141
-    protected function getEnvironment()
142
-    {
134
+    protected function getEnvironment() {
143 135
         $projectName = $this->getRequest()->param('Project');
144 136
         $project = DNProject::get()->filter('Name', $projectName)->first();
145 137
         $environmentName = $this->getRequest()->param('Environment');
@@ -149,8 +141,7 @@  discard block
 block discarded – undo
149 141
     /**
150 142
      * @return string
151 143
      */
152
-    public function Link()
153
-    {
144
+    public function Link() {
154 145
         return 'naut/api';
155 146
     }
156 147
 }
Please login to merge, or discard this patch.
code/api/nouns/APIEnvironment.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class APIEnvironment extends APINoun
4
-{
3
+class APIEnvironment extends APINoun {
5 4
 
6 5
     /**
7 6
      * @var array
@@ -15,8 +14,7 @@  discard block
 block discarded – undo
15 14
      * @param SS_HTTPRequest $request
16 15
      * @return SS_HTTPResponse
17 16
      */
18
-    public function index(SS_HTTPRequest $request)
19
-    {
17
+    public function index(SS_HTTPRequest $request) {
20 18
         if (!$this->record->canView($this->getMember())) {
21 19
             return $this->message('You are not authorized to view this environment', 403);
22 20
         }
@@ -52,8 +50,7 @@  discard block
 block discarded – undo
52 50
      * @param SS_HTTPRequest $request
53 51
      * @return SS_HTTPResponse
54 52
      */
55
-    public function ping(SS_HTTPRequest $request)
56
-    {
53
+    public function ping(SS_HTTPRequest $request) {
57 54
         if (!$this->record->canView($this->getMember())) {
58 55
             return $this->message('You are not authorized to do that on this environment', 403);
59 56
         }
@@ -71,8 +68,7 @@  discard block
 block discarded – undo
71 68
      * @param SS_HTTPRequest $request
72 69
      * @return SS_HTTPResponse
73 70
      */
74
-    public function deploy(SS_HTTPRequest $request)
75
-    {
71
+    public function deploy(SS_HTTPRequest $request) {
76 72
         if (!$this->record->canView($this->getMember())) {
77 73
             return $this->message('You are not authorized to do that on this environment', 403);
78 74
         }
@@ -89,8 +85,7 @@  discard block
 block discarded – undo
89 85
     /**
90 86
      * @return string
91 87
      */
92
-    public function Link()
93
-    {
88
+    public function Link() {
94 89
         return Controller::join_links(
95 90
             $this->parent->Link(),
96 91
             $this->record->Project()->Name,
@@ -101,16 +96,14 @@  discard block
 block discarded – undo
101 96
     /**
102 97
      * @return SS_HTTPResponse
103 98
      */
104
-    protected function showRecord()
105
-    {
99
+    protected function showRecord() {
106 100
         return $this->getAPIResponse($this->record->toMap());
107 101
     }
108 102
 
109 103
     /**
110 104
      * @return SS_HTTPResponse
111 105
      */
112
-    protected function createPing()
113
-    {
106
+    protected function createPing() {
114 107
         if (!$this->record->canDeploy($this->getMember())) {
115 108
             return $this->message('You are not authorized to do that on this environment', 403);
116 109
         }
@@ -135,8 +128,7 @@  discard block
 block discarded – undo
135 128
      * @param int $ID
136 129
      * @return SS_HTTPResponse
137 130
      */
138
-    protected function getPing($ID)
139
-    {
131
+    protected function getPing($ID) {
140 132
         $ping = DNPing::get()->byID($ID);
141 133
         if (!$ping) {
142 134
             return $this->message('Ping not found', 404);
@@ -152,8 +144,7 @@  discard block
 block discarded – undo
152 144
     /**
153 145
      * @return SS_HTTPResponse
154 146
      */
155
-    protected function createDeploy()
156
-    {
147
+    protected function createDeploy() {
157 148
         if (!$this->record->canDeploy($this->getMember())) {
158 149
             return $this->message('You are not authorized to do that on this environment', 403);
159 150
         }
@@ -188,8 +179,7 @@  discard block
 block discarded – undo
188 179
      * @param int $id
189 180
      * @return SS_HTTPResponse
190 181
      */
191
-    protected function getDeploy($id)
192
-    {
182
+    protected function getDeploy($id) {
193 183
         $deploy = DNDeployment::get()->byID($id);
194 184
         if (!$deploy) {
195 185
             return $this->message('Deploy not found', 404);
Please login to merge, or discard this patch.
code/api/nouns/APINoun.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Base class for the APINouns
4 4
  */
5
-class APINoun extends Controller
6
-{
5
+class APINoun extends Controller {
7 6
 
8 7
     /**
9 8
      * @var controller
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
      * @param Controller|null $parent
27 26
      * @param DataObject|null $record
28 27
      */
29
-    public function __construct(\Controller $parent = null, DataObject $record = null)
30
-    {
28
+    public function __construct(\Controller $parent = null, DataObject $record = null) {
31 29
         $this->record = $record;
32 30
         $this->parent = $parent;
33 31
         parent::__construct();
@@ -36,8 +34,7 @@  discard block
 block discarded – undo
36 34
     /**
37 35
      * Enable basic auth on the API
38 36
      */
39
-    public function init()
40
-    {
37
+    public function init() {
41 38
         $this->member = BasicAuth::requireLogin('Deploynaut API');
42 39
         parent::init();
43 40
     }
@@ -45,16 +42,14 @@  discard block
 block discarded – undo
45 42
     /**
46 43
      * @return DataObject
47 44
      */
48
-    public function getRecord()
49
-    {
45
+    public function getRecord() {
50 46
         return $this->record;
51 47
     }
52 48
 
53 49
     /**
54 50
      * @return Member
55 51
      */
56
-    public function getMember()
57
-    {
52
+    public function getMember() {
58 53
         return $this->member;
59 54
     }
60 55
 
@@ -62,8 +57,7 @@  discard block
 block discarded – undo
62 57
      * @param array $output
63 58
      * @return SS_HTTPResponse
64 59
      */
65
-    protected function getAPIResponse($output)
66
-    {
60
+    protected function getAPIResponse($output) {
67 61
         $response = $this->getResponse();
68 62
         if ($this->respondWithText()) {
69 63
             $body = print_r($output, true);
@@ -79,8 +73,7 @@  discard block
 block discarded – undo
79 73
     /**
80 74
      * @return boolean
81 75
      */
82
-    protected function respondWithJSON()
83
-    {
76
+    protected function respondWithJSON() {
84 77
         if ($this->getRequest()->getExtension() == 'json') {
85 78
             return true;
86 79
         }
@@ -93,8 +86,7 @@  discard block
 block discarded – undo
93 86
     /**
94 87
      * @return boolean
95 88
      */
96
-    protected function respondWithText()
97
-    {
89
+    protected function respondWithText() {
98 90
         if ($this->getRequest()->getExtension() == 'txt') {
99 91
             return true;
100 92
         }
@@ -107,8 +99,7 @@  discard block
 block discarded – undo
107 99
     /**
108 100
      * @return array|null
109 101
      */
110
-    protected function getRequestBody()
111
-    {
102
+    protected function getRequestBody() {
112 103
         return Convert::json2array($this->getRequest()->getBody());
113 104
     }
114 105
 
@@ -119,8 +110,7 @@  discard block
 block discarded – undo
119 110
      * @param int $statusCode
120 111
      * @return SS_HTTPResponse
121 112
      */
122
-    protected function message($message, $statusCode)
123
-    {
113
+    protected function message($message, $statusCode) {
124 114
         $response = $this->getAPIResponse(array(
125 115
             'message' => $message,
126 116
             'statusCode' => $statusCode
Please login to merge, or discard this patch.
code/api/nouns/APIProject.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class APIProject extends APINoun
4
-{
3
+class APIProject extends APINoun {
5 4
 
6 5
     /**
7 6
      * @var array
@@ -15,8 +14,7 @@  discard block
 block discarded – undo
15 14
      * @param SS_HTTPRequest $request
16 15
      * @return SS_HTTPResponse
17 16
      */
18
-    public function index(SS_HTTPRequest $request)
19
-    {
17
+    public function index(SS_HTTPRequest $request) {
20 18
         if (!$this->record->canView($this->getMember())) {
21 19
             return $this->message('You are not authorized to this environment', 403);
22 20
         }
@@ -48,8 +46,7 @@  discard block
 block discarded – undo
48 46
      * @param SS_HTTPRequest $request
49 47
      * @return SS_HTTPResponse
50 48
      */
51
-    public function fetch(SS_HTTPRequest $request)
52
-    {
49
+    public function fetch(SS_HTTPRequest $request) {
53 50
         if (!$this->record->canView($this->getMember())) {
54 51
             return $this->message('You are not authorized to do that on this environment', 403);
55 52
         }
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
      * @param int $ID
68 65
      * @return SS_HTTPResponse
69 66
      */
70
-    protected function getFetch($ID)
71
-    {
67
+    protected function getFetch($ID) {
72 68
         $ping = DNGitFetch::get()->byID($ID);
73 69
         if (!$ping) {
74 70
             return $this->message('Fetch not found', 404);
@@ -84,8 +80,7 @@  discard block
 block discarded – undo
84 80
     /**
85 81
      * @return SS_HTTPResponse
86 82
      */
87
-    protected function createFetch()
88
-    {
83
+    protected function createFetch() {
89 84
         /** @var DNGitFetch $fetch */
90 85
         $fetch = DNGitFetch::create();
91 86
         $fetch->ProjectID = $this->record->ID;
@@ -107,8 +102,7 @@  discard block
 block discarded – undo
107 102
     /**
108 103
      * @return string
109 104
      */
110
-    public function Link()
111
-    {
105
+    public function Link() {
112 106
         return Controller::join_links(
113 107
             $this->parent->Link(),
114 108
             $this->record->Name
Please login to merge, or discard this patch.
code/backends/CapistranoDeploymentBackend.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,18 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use \Symfony\Component\Process\Process;
3 3
 
4
-class CapistranoDeploymentBackend extends Object implements DeploymentBackend
5
-{
4
+class CapistranoDeploymentBackend extends Object implements DeploymentBackend {
6 5
 
7 6
     protected $packageGenerator;
8 7
 
9
-    public function getPackageGenerator()
10
-    {
8
+    public function getPackageGenerator() {
11 9
         return $this->packageGenerator;
12 10
     }
13 11
 
14
-    public function setPackageGenerator(PackageGenerator $packageGenerator)
15
-    {
12
+    public function setPackageGenerator(PackageGenerator $packageGenerator) {
16 13
         $this->packageGenerator = $packageGenerator;
17 14
     }
18 15
 
@@ -24,8 +21,7 @@  discard block
 block discarded – undo
24 21
      *
25 22
      * @return DeploymentStrategy
26 23
      */
27
-    public function planDeploy(DNEnvironment $environment, $options)
28
-    {
24
+    public function planDeploy(DNEnvironment $environment, $options) {
29 25
         $strategy = new DeploymentStrategy($environment, $options);
30 26
 
31 27
         $currentBuild = $environment->CurrentBuild();
@@ -131,8 +127,7 @@  discard block
 block discarded – undo
131 127
     /**
132 128
      * Enable a maintenance page for the given environment using the maintenance:enable Capistrano task.
133 129
      */
134
-    public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project)
135
-    {
130
+    public function enableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
136 131
         $name = $environment->getFullName();
137 132
         $command = $this->getCommand('maintenance:enable', 'web', $environment, null, $log);
138 133
         $command->run(function ($type, $buffer) use ($log) {
@@ -148,8 +143,7 @@  discard block
 block discarded – undo
148 143
     /**
149 144
      * Disable the maintenance page for the given environment using the maintenance:disable Capistrano task.
150 145
      */
151
-    public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project)
152
-    {
146
+    public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
153 147
         $name = $environment->getFullName();
154 148
         $command = $this->getCommand('maintenance:disable', 'web', $environment, null, $log);
155 149
         $command->run(function ($type, $buffer) use ($log) {
@@ -165,8 +159,7 @@  discard block
 block discarded – undo
165 159
     /**
166 160
      * Check the status using the deploy:check capistrano method
167 161
      */
168
-    public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project)
169
-    {
162
+    public function ping(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
170 163
         $command = $this->getCommand('deploy:check', 'web', $environment, null, $log);
171 164
         $command->run(function ($type, $buffer) use ($log) {
172 165
             $log->write($buffer);
@@ -177,8 +170,7 @@  discard block
 block discarded – undo
177 170
     /**
178 171
      * @inheritdoc
179 172
      */
180
-    public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log)
181
-    {
173
+    public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) {
182 174
         if ($dataTransfer->Direction == 'get') {
183 175
             $this->dataTransferBackup($dataTransfer, $log);
184 176
         } else {
@@ -222,8 +214,7 @@  discard block
 block discarded – undo
222 214
      * @param DeploynautLogFile $log
223 215
      * @return \Symfony\Component\Process\Process
224 216
      */
225
-    public function getCommand($action, $roles, DNEnvironment $environment, $args = null, DeploynautLogFile $log)
226
-    {
217
+    public function getCommand($action, $roles, DNEnvironment $environment, $args = null, DeploynautLogFile $log) {
227 218
         $name = $environment->getFullName();
228 219
         $env = $environment->Project()->getProcessEnv();
229 220
 
@@ -277,8 +268,7 @@  discard block
 block discarded – undo
277 268
      * @param DNDataTransfer    $dataTransfer
278 269
      * @param DeploynautLogFile $log
279 270
      */
280
-    protected function dataTransferBackup(DNDataTransfer $dataTransfer, DeploynautLogFile $log)
281
-    {
271
+    protected function dataTransferBackup(DNDataTransfer $dataTransfer, DeploynautLogFile $log) {
282 272
         $environment = $dataTransfer->Environment();
283 273
         $name = $environment->getFullName();
284 274
 
@@ -354,8 +344,7 @@  discard block
 block discarded – undo
354 344
      * Also cleans up and generates new error pages.
355 345
      * @param DeploynautLogFile $log
356 346
      */
357
-    public function rebuild(DNEnvironment $environment, $log)
358
-    {
347
+    public function rebuild(DNEnvironment $environment, $log) {
359 348
         $name = $environment->getFullName();
360 349
         $command = $this->getCommand('deploy:migrate', 'web', $environment, null, $log);
361 350
         $command->run(function ($type, $buffer) use ($log) {
@@ -376,8 +365,7 @@  discard block
 block discarded – undo
376 365
      * @param DNDataTransfer $dataTransfer
377 366
      * @param DeploynautLogFile $log
378 367
      */
379
-    protected function dataTransferRestore($workingDir, DNDataTransfer $dataTransfer, DeploynautLogFile $log)
380
-    {
368
+    protected function dataTransferRestore($workingDir, DNDataTransfer $dataTransfer, DeploynautLogFile $log) {
381 369
         $environment = $dataTransfer->Environment();
382 370
         $name = $environment->getFullName();
383 371
 
Please login to merge, or discard this patch.
code/backends/DemoDeploymentBackend.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  * It's useful for demonstrating how the system works, and how you can write deployment back-ends
9 9
  */
10
-class DemoDeploymentBackend extends Object implements DeploymentBackend
11
-{
10
+class DemoDeploymentBackend extends Object implements DeploymentBackend {
12 11
 
13 12
     /**
14 13
      * Create a deployment strategy.
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
      *
19 18
      * @return DeploymentStrategy
20 19
      */
21
-    public function planDeploy(DNEnvironment $environment, $options = array())
22
-    {
20
+    public function planDeploy(DNEnvironment $environment, $options = array()) {
23 21
         return new DeploymentStrategy($environment, $options);
24 22
     }
25 23
 
@@ -69,23 +67,19 @@  discard block
 block discarded – undo
69 67
     /**
70 68
      * @inheritdoc
71 69
      */
72
-    public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log)
73
-    {
70
+    public function dataTransfer(DNDataTransfer $dataTransfer, DeploynautLogFile $log) {
74 71
         die('Not implemented');
75 72
     }
76 73
 
77
-    public function enableMaintenance(DNEnvironment $environment, \DeploynautLogFile $log, DNProject $project)
78
-    {
74
+    public function enableMaintenance(DNEnvironment $environment, \DeploynautLogFile $log, DNProject $project) {
79 75
         $log->write(sprintf('Maintenance page enabled on "%s"', $environment->getFullName()));
80 76
     }
81 77
 
82
-    public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project)
83
-    {
78
+    public function disableMaintenance(DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
84 79
         $log->write(sprintf('Maintenance page disabled on "%s"', $environment->getFullName()));
85 80
     }
86 81
 
87
-    public function ping(\DNEnvironment $environment, DeploynautLogFile $log, DNProject $project)
88
-    {
82
+    public function ping(\DNEnvironment $environment, DeploynautLogFile $log, DNProject $project) {
89 83
         $log->write(sprintf('Ping "%s"', $environment->getFullName()));
90 84
     }
91 85
 }
Please login to merge, or discard this patch.
code/backends/DeploymentBackend.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-interface DeploymentBackend
4
-{
3
+interface DeploymentBackend {
5 4
 
6 5
     /**
7 6
      * Creates a deployment strategy that can be used to do some pre-flight checks.
Please login to merge, or discard this patch.