Completed
Pull Request — master (#489)
by Helpful
03:51
created
code/form/TabbedSelectionGroup.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class TabbedSelectionGroup extends SelectionGroup
4
-{
3
+class TabbedSelectionGroup extends SelectionGroup {
5 4
 
6 5
     /**
7 6
      * @return ArrayList
8 7
      */
9
-    public function FieldList()
10
-    {
8
+    public function FieldList() {
11 9
         $items = CompositeField::FieldList()->toArray();
12 10
         $fields = new ArrayList();
13 11
 
Please login to merge, or discard this patch.
code/jobs/CreateEnvJob.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class CreateEnvJob
3
-{
2
+class CreateEnvJob {
4 3
 
5 4
     /**
6 5
      *
@@ -11,8 +10,7 @@  discard block
 block discarded – undo
11 10
     /**
12 11
      *
13 12
      */
14
-    public function setUp()
15
-    {
13
+    public function setUp() {
16 14
         $this->updateStatus('Started');
17 15
         chdir(BASE_PATH);
18 16
     }
@@ -21,8 +19,7 @@  discard block
 block discarded – undo
21 19
      *
22 20
      * @global array $databaseConfig
23 21
      */
24
-    public function tearDown()
25
-    {
22
+    public function tearDown() {
26 23
         $this->updateStatus('Finished');
27 24
         chdir(BASE_PATH);
28 25
     }
@@ -30,8 +27,7 @@  discard block
 block discarded – undo
30 27
     /**
31 28
      *
32 29
      */
33
-    public function perform()
34
-    {
30
+    public function perform() {
35 31
         echo "[-] CreateEnvJob starting" . PHP_EOL;
36 32
         // This is a bit icky, but there is no easy way of capturing a failed deploy by using the PHP Resque
37 33
         try {
@@ -55,8 +51,7 @@  discard block
 block discarded – undo
55 51
      * @param string $status
56 52
      * @global array $databaseConfig
57 53
      */
58
-    protected function updateStatus($status)
59
-    {
54
+    protected function updateStatus($status) {
60 55
         global $databaseConfig;
61 56
         DB::connect($databaseConfig);
62 57
 
@@ -69,8 +64,7 @@  discard block
 block discarded – undo
69 64
      *
70 65
      * @return DNData
71 66
      */
72
-    protected function DNData()
73
-    {
67
+    protected function DNData() {
74 68
         return DNData::inst();
75 69
     }
76 70
 }
Please login to merge, or discard this patch.
code/jobs/DataTransferJob.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,28 +7,24 @@  discard block
 block discarded – undo
7 7
  * @package deploynaut
8 8
  * @subpackage jobs
9 9
  */
10
-class DataTransferJob
11
-{
10
+class DataTransferJob {
12 11
 
13 12
     /**
14 13
      * set by a resque worker
15 14
      */
16 15
     public $args = array();
17 16
 
18
-    public function setUp()
19
-    {
17
+    public function setUp() {
20 18
         $this->updateStatus('Started');
21 19
         chdir(BASE_PATH);
22 20
     }
23 21
 
24
-    public function tearDown()
25
-    {
22
+    public function tearDown() {
26 23
         $this->updateStatus('Finished');
27 24
         chdir(BASE_PATH);
28 25
     }
29 26
 
30
-    public function perform()
31
-    {
27
+    public function perform() {
32 28
         echo "[-] DataTransferJob starting" . PHP_EOL;
33 29
         $log = new DeploynautLogFile($this->args['logfile']);
34 30
         $dataTransfer = DNDataTransfer::get()->byID($this->args['dataTransferID']);
@@ -114,8 +110,7 @@  discard block
 block discarded – undo
114 110
      * @param string $status
115 111
      * @global array $databaseConfig
116 112
      */
117
-    protected function updateStatus($status)
118
-    {
113
+    protected function updateStatus($status) {
119 114
         global $databaseConfig;
120 115
         DB::connect($databaseConfig);
121 116
         $env = DNDataTransfer::get()->byID($this->args['dataTransferID']);
@@ -126,8 +121,7 @@  discard block
 block discarded – undo
126 121
     /**
127 122
      * @return DNData
128 123
      */
129
-    protected function DNData()
130
-    {
124
+    protected function DNData() {
131 125
         return DNData::inst();
132 126
     }
133 127
 }
Please login to merge, or discard this patch.
code/jobs/DeployJob.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,28 +3,24 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Runs a deployment via the most appropriate backend
5 5
  */
6
-class DeployJob
7
-{
6
+class DeployJob {
8 7
 
9 8
     /**
10 9
      * @var array
11 10
      */
12 11
     public $args;
13 12
 
14
-    public function setUp()
15
-    {
13
+    public function setUp() {
16 14
         $this->updateStatus('Started');
17 15
         chdir(BASE_PATH);
18 16
     }
19 17
 
20
-    public function tearDown()
21
-    {
18
+    public function tearDown() {
22 19
         $this->updateStatus('Finished');
23 20
         chdir(BASE_PATH);
24 21
     }
25 22
 
26
-    public function perform()
27
-    {
23
+    public function perform() {
28 24
         echo "[-] DeployJob starting" . PHP_EOL;
29 25
         $log = new DeploynautLogFile($this->args['logfile']);
30 26
         $DNProject = $this->DNData()->DNProjectList()->filter('Name', $this->args['projectName'])->First();
@@ -75,8 +71,7 @@  discard block
 block discarded – undo
75 71
      * @param string $status
76 72
      * @global array $databaseConfig
77 73
      */
78
-    protected function updateStatus($status)
79
-    {
74
+    protected function updateStatus($status) {
80 75
         global $databaseConfig;
81 76
         DB::connect($databaseConfig);
82 77
         $dnDeployment = DNDeployment::get()->byID($this->args['deploymentID']);
@@ -87,8 +82,7 @@  discard block
 block discarded – undo
87 82
     /**
88 83
      * @return DNData
89 84
      */
90
-    protected function DNData()
91
-    {
85
+    protected function DNData() {
92 86
         return DNData::inst();
93 87
     }
94 88
 }
Please login to merge, or discard this patch.
code/jobs/FetchJob.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class FetchJob
4
-{
3
+class FetchJob {
5 4
 
6 5
     public $args;
7 6
 
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
     /**
24 23
      * @global array $databaseConfig
25 24
      */
26
-    public function setUp()
27
-    {
25
+    public function setUp() {
28 26
         global $databaseConfig;
29 27
         DB::connect($databaseConfig);
30 28
 
@@ -32,14 +30,12 @@  discard block
 block discarded – undo
32 30
         chdir(BASE_PATH);
33 31
     }
34 32
 
35
-    public function tearDown()
36
-    {
33
+    public function tearDown() {
37 34
         $this->updateStatus('Finished');
38 35
         chdir(BASE_PATH);
39 36
     }
40 37
 
41
-    public function perform()
42
-    {
38
+    public function perform() {
43 39
         set_time_limit(0);
44 40
 
45 41
         if (!empty($this->args['logfile'])) {
@@ -95,16 +91,14 @@  discard block
 block discarded – undo
95 91
         }
96 92
     }
97 93
 
98
-    protected function fetchRepo()
99
-    {
94
+    protected function fetchRepo() {
100 95
         $this->runCommand(
101 96
             'git fetch -p origin +refs/heads/*:refs/heads/* --tags',
102 97
             $this->project->getLocalCVSPath()
103 98
         );
104 99
     }
105 100
 
106
-    protected function cloneRepo()
107
-    {
101
+    protected function cloneRepo() {
108 102
         if (file_exists($this->project->getLocalCVSPath())) {
109 103
             $this->runCommand(sprintf(
110 104
                 'rm -rf %s',
@@ -126,8 +120,7 @@  discard block
 block discarded – undo
126 120
      * @param string|null $workingDir The working dir to run command in
127 121
      * @throws RuntimeException
128 122
      */
129
-    protected function runCommand($command, $workingDir = null)
130
-    {
123
+    protected function runCommand($command, $workingDir = null) {
131 124
         if (!empty($this->user)) {
132 125
             $command = sprintf('sudo -u %s %s', $this->user, $command);
133 126
         }
@@ -147,8 +140,7 @@  discard block
 block discarded – undo
147 140
      * @param string $status
148 141
      * @global array $databaseConfig
149 142
      */
150
-    protected function updateStatus($status)
151
-    {
143
+    protected function updateStatus($status) {
152 144
         global $databaseConfig;
153 145
         DB::connect($databaseConfig);
154 146
 
Please login to merge, or discard this patch.
code/jobs/PingJob.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
  * Runs a capistrano job that will check the connection and that all folders with
5 5
  * permission are setup correctly
6 6
  */
7
-class PingJob
8
-{
7
+class PingJob {
9 8
 
10 9
     /**
11 10
      * @var array
@@ -15,8 +14,7 @@  discard block
 block discarded – undo
15 14
     /**
16 15
      * @global array $databaseConfig
17 16
      */
18
-    public function setUp()
19
-    {
17
+    public function setUp() {
20 18
         global $databaseConfig;
21 19
         DB::connect($databaseConfig);
22 20
         chdir(BASE_PATH);
@@ -25,16 +23,14 @@  discard block
 block discarded – undo
25 23
     /**
26 24
      * @return DNData
27 25
      */
28
-    public function DNData()
29
-    {
26
+    public function DNData() {
30 27
         return DNData::inst();
31 28
     }
32 29
 
33 30
     /**
34 31
      * Do the actual job by calling the appropiate backend
35 32
      */
36
-    public function perform()
37
-    {
33
+    public function perform() {
38 34
         echo "[-] PingJob starting" . PHP_EOL;
39 35
         $log = new DeploynautLogFile($this->args['logfile']);
40 36
         $DNProject = $this->DNData()->DNProjectList()->filter('Name', $this->args['projectName'])->First();
Please login to merge, or discard this patch.
code/model/DNBranch.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  * @method string getName()
7 7
  */
8
-class DNBranch extends ViewableData
9
-{
8
+class DNBranch extends ViewableData {
10 9
 
11 10
     /**
12 11
      * @var Gitonomy\Git\Reference\Branch
@@ -37,28 +36,24 @@  discard block
 block discarded – undo
37 36
      * @param DNProject $project
38 37
      * @param DNData $data
39 38
      */
40
-    public function __construct(Gitonomy\Git\Reference\Branch $branch, DNProject $project, DNData $data)
41
-    {
39
+    public function __construct(Gitonomy\Git\Reference\Branch $branch, DNProject $project, DNData $data) {
42 40
         $this->branch = $branch;
43 41
         $this->project = $project;
44 42
         $this->data = $data;
45 43
     }
46 44
 
47
-    public function __toString()
48
-    {
45
+    public function __toString() {
49 46
         return $this->Name();
50 47
     }
51 48
 
52 49
     /**
53 50
      * @return string
54 51
      */
55
-    public function Name()
56
-    {
52
+    public function Name() {
57 53
         return (string)htmlentities($this->branch->getName());
58 54
     }
59 55
 
60
-    public function Link()
61
-    {
56
+    public function Link() {
62 57
         // Use a get-var for branch so that it can handle unsafe chars better
63 58
         return Controller::join_links($this->project->Link(), 'branch?name=' . urlencode($this->Name()));
64 59
     }
@@ -66,16 +61,14 @@  discard block
 block discarded – undo
66 61
     /**
67 62
      * @return string
68 63
      */
69
-    public function SHA()
70
-    {
64
+    public function SHA() {
71 65
         return (string)htmlentities($this->branch->getCommit()->getHash());
72 66
     }
73 67
 
74 68
     /**
75 69
      * Provides a DNBuildList of builds found in this project.
76 70
      */
77
-    public function DNBuildList()
78
-    {
71
+    public function DNBuildList() {
79 72
         $blockBranch = $this->branch->getName() == 'master' ? null : 'master';
80 73
         return DNReferenceList::create($this->project, $this->data, $this->branch, $blockBranch);
81 74
     }
@@ -83,8 +76,7 @@  discard block
 block discarded – undo
83 76
     /**
84 77
      * @return SS_Datetime
85 78
      */
86
-    public function LastUpdated()
87
-    {
79
+    public function LastUpdated() {
88 80
         if ($this->_lastUpdatedCache) {
89 81
             return $this->_lastUpdatedCache;
90 82
         }
@@ -109,8 +101,7 @@  discard block
 block discarded – undo
109 101
     /**
110 102
      * @return string
111 103
      */
112
-    public function IsOpenByDefault()
113
-    {
104
+    public function IsOpenByDefault() {
114 105
         if ($this->Name() == 'master') {
115 106
             return " open";
116 107
         } else {
Please login to merge, or discard this patch.
code/model/DNBranchList.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Class DNBranchList
5 5
  */
6
-class DNBranchList extends ArrayList
7
-{
6
+class DNBranchList extends ArrayList {
8 7
 
9 8
     /**
10 9
      * @var string
@@ -31,13 +30,11 @@  discard block
 block discarded – undo
31 30
      */
32 31
     protected $data;
33 32
 
34
-    public static function set_refs_dir($refsDir)
35
-    {
33
+    public static function set_refs_dir($refsDir) {
36 34
         self::$refs_dir = $refsDir;
37 35
     }
38 36
 
39
-    public static function get_refs_dir()
40
-    {
37
+    public static function get_refs_dir() {
41 38
         return self::$refs_dir;
42 39
     }
43 40
 
@@ -45,8 +42,7 @@  discard block
 block discarded – undo
45 42
      * @param DNProject $project
46 43
      * @param DNData $data
47 44
      */
48
-    public function __construct(DNProject $project, DNData $data)
49
-    {
45
+    public function __construct(DNProject $project, DNData $data) {
50 46
         $this->project = $project;
51 47
         $this->data = $data;
52 48
         parent::__construct(array());
@@ -55,8 +51,7 @@  discard block
 block discarded – undo
55 51
     /**
56 52
      * @return array
57 53
      */
58
-    protected function getReferences()
59
-    {
54
+    protected function getReferences() {
60 55
         $branches = array();
61 56
         // Placeholder to put master branch first
62 57
         $firstBranch = null;
@@ -90,8 +85,7 @@  discard block
 block discarded – undo
90 85
      *
91 86
      * @return string
92 87
      */
93
-    public function byName($name)
94
-    {
88
+    public function byName($name) {
95 89
         if ($this->loaded === false) {
96 90
             $this->getIterator();
97 91
         }
@@ -109,8 +103,7 @@  discard block
 block discarded – undo
109 103
      *
110 104
      * @return ArrayIterator
111 105
      */
112
-    public function getIterator()
113
-    {
106
+    public function getIterator() {
114 107
         if ($this->loaded === false) {
115 108
             $this->items = $this->getReferences();
116 109
             $this->loaded = true;
Please login to merge, or discard this patch.
code/model/DNCommit.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class DNCommit extends ViewableData
3
-{
2
+class DNCommit extends ViewableData {
4 3
 
5 4
     /**
6 5
      * @var Gitonomy\Git\Commit
@@ -62,8 +61,7 @@  discard block
 block discarded – undo
62 61
      * @param DNData $data
63 62
      * @param string|null $ownerBranchName
64 63
      */
65
-    public function __construct(Gitonomy\Git\Commit $commit, DNProject $project, DNData $data, $ownerBranchName = null)
66
-    {
64
+    public function __construct(Gitonomy\Git\Commit $commit, DNProject $project, DNData $data, $ownerBranchName = null) {
67 65
         $this->commit = $commit;
68 66
         $this->buildname = $commit->getHash();
69 67
         $this->project = $project;
@@ -75,8 +73,7 @@  discard block
 block discarded – undo
75 73
      * Return the hash of the commit, used to name this commit.
76 74
      * @return string
77 75
      */
78
-    public function Name()
79
-    {
76
+    public function Name() {
80 77
         if ($this->name == null) {
81 78
             $this->name = $this->commit->getFixedShortHash(8);
82 79
         }
@@ -88,8 +85,7 @@  discard block
 block discarded – undo
88 85
      * Return the full SHA of the commit.
89 86
      * @return string
90 87
      */
91
-    public function SHA()
92
-    {
88
+    public function SHA() {
93 89
         return htmlentities($this->commit->getHash());
94 90
     }
95 91
 
@@ -97,8 +93,7 @@  discard block
 block discarded – undo
97 93
      * Return the first line of the commit message.
98 94
      * @return string
99 95
      */
100
-    public function SubjectMessage()
101
-    {
96
+    public function SubjectMessage() {
102 97
         if ($this->subjectMessage == null) {
103 98
             $this->subjectMessage = $this->commit->getSubjectMessage();
104 99
         }
@@ -106,8 +101,7 @@  discard block
 block discarded – undo
106 101
         return htmlentities($this->subjectMessage);
107 102
     }
108 103
 
109
-    public function BodyMessage()
110
-    {
104
+    public function BodyMessage() {
111 105
         if ($this->bodyMessage == null) {
112 106
             $this->bodyMessage = $this->commit->getBodyMessage();
113 107
         }
@@ -118,8 +112,7 @@  discard block
 block discarded – undo
118 112
     /**
119 113
      * @return ArrayList
120 114
      */
121
-    public function References()
122
-    {
115
+    public function References() {
123 116
         if ($this->references !== null) {
124 117
             return $this->references;
125 118
         }
@@ -141,24 +134,21 @@  discard block
 block discarded – undo
141 134
     /**
142 135
      * @return string
143 136
      */
144
-    public function FullName()
145
-    {
137
+    public function FullName() {
146 138
         return htmlentities($this->commit->getHash());
147 139
     }
148 140
 
149 141
     /**
150 142
      * @return string
151 143
      */
152
-    public function Filename()
153
-    {
144
+    public function Filename() {
154 145
         return htmlentities($this->commit->getHash());
155 146
     }
156 147
 
157 148
     /**
158 149
      * @return ArrayList
159 150
      */
160
-    public function CurrentlyDeployedTo()
161
-    {
151
+    public function CurrentlyDeployedTo() {
162 152
         $environments = $this->project->Environments();
163 153
         $envList = new ArrayList();
164 154
         foreach ($environments as $environment) {
@@ -181,8 +171,7 @@  discard block
 block discarded – undo
181 171
      * @param string $environmentName
182 172
      * @return boolean True if this release has ever been deployed to the given environment
183 173
      */
184
-    public function EverDeployedTo($environmentName)
185
-    {
174
+    public function EverDeployedTo($environmentName) {
186 175
         $environments = $this->project->Environments()->filter('Name', $environmentName);
187 176
         if (!$environments->count()) {
188 177
             return false;
@@ -204,8 +193,7 @@  discard block
 block discarded – undo
204 193
     /**
205 194
      * @return SS_Datetime
206 195
      */
207
-    public function Created()
208
-    {
196
+    public function Created() {
209 197
         $created = $this->commit->getCommitterDate();
210 198
 
211 199
         // gitonomy sets the time to UTC, so now we set the timezone to
Please login to merge, or discard this patch.