@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function LogLink() { |
| 119 | - return $this->Link() . '/log'; |
|
| 119 | + return $this->Link().'/log'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function canView($member = null) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @return \Gitonomy\Git\Repository|null |
| 163 | 163 | */ |
| 164 | 164 | public function getRepository() { |
| 165 | - if(!$this->SHA) { |
|
| 165 | + if (!$this->SHA) { |
|
| 166 | 166 | return null; |
| 167 | 167 | } |
| 168 | 168 | return $this->Environment()->Project()->getRepository(); |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function getCommit() { |
| 177 | 177 | $repo = $this->getRepository(); |
| 178 | - if($repo) { |
|
| 178 | + if ($repo) { |
|
| 179 | 179 | try { |
| 180 | 180 | return $this->Environment()->getCommit($this->SHA); |
| 181 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
| 181 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $ex) { |
|
| 182 | 182 | return null; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | if (!$interface) { |
| 204 | 204 | return null; |
| 205 | 205 | } |
| 206 | - return $interface->CommitURL . '/' . $this->SHA; |
|
| 206 | + return $interface->CommitURL.'/'.$this->SHA; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function getCommitMessage() { |
| 215 | 215 | $commit = $this->getCommit(); |
| 216 | - if($commit) { |
|
| 216 | + if ($commit) { |
|
| 217 | 217 | try { |
| 218 | 218 | return Convert::raw2xml($this->Environment()->getCommitMessage($commit)); |
| 219 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 219 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 220 | 220 | return null; |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function getCommitSubjectMessage() { |
| 232 | 232 | $commit = $this->getCommit(); |
| 233 | - if($commit) { |
|
| 233 | + if ($commit) { |
|
| 234 | 234 | try { |
| 235 | 235 | return Convert::raw2xml($this->Environment()->getCommitSubjectMessage($commit)); |
| 236 | - } catch(Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 236 | + } catch (Gitonomy\Git\Exception\ReferenceNotFoundException $e) { |
|
| 237 | 237 | return null; |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function getTags() { |
| 249 | 249 | $commit = $this->Environment()->getCommit($this->SHA); |
| 250 | - if(!$commit) { |
|
| 250 | + if (!$commit) { |
|
| 251 | 251 | return new ArrayList([]); |
| 252 | 252 | } |
| 253 | 253 | $tags = $this->Environment()->getCommitTags($commit); |
| 254 | 254 | $returnTags = []; |
| 255 | 255 | if (!empty($tags)) { |
| 256 | - foreach($tags as $tag) { |
|
| 256 | + foreach ($tags as $tag) { |
|
| 257 | 257 | $field = Varchar::create('Tag', '255'); |
| 258 | 258 | $field->setValue($tag->getName()); |
| 259 | 259 | $returnTags[] = $field; |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | public function getFullDeployMessages() { |
| 272 | 272 | $strategy = $this->getDeploymentStrategy(); |
| 273 | - if ($strategy->getActionCode()!=='full') return null; |
|
| 273 | + if ($strategy->getActionCode() !== 'full') return null; |
|
| 274 | 274 | |
| 275 | 275 | $changes = $strategy->getChangesModificationNeeded(); |
| 276 | 276 | $messages = []; |
| 277 | 277 | foreach ($changes as $change => $details) { |
| 278 | - if ($change==='Code version') continue; |
|
| 278 | + if ($change === 'Code version') continue; |
|
| 279 | 279 | |
| 280 | 280 | $messages[] = [ |
| 281 | 281 | 'Flag' => sprintf( |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function getTag() { |
| 305 | 305 | $tags = $this->getTags(); |
| 306 | - if($tags->count() > 0) { |
|
| 306 | + if ($tags->count() > 0) { |
|
| 307 | 307 | return $tags->last(); |
| 308 | 308 | } |
| 309 | 309 | return null; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | public function getChanges() { |
| 329 | 329 | $list = new ArrayList(); |
| 330 | 330 | $strategy = $this->getDeploymentStrategy(); |
| 331 | - foreach($strategy->getChanges() as $name => $change) { |
|
| 331 | + foreach ($strategy->getChanges() as $name => $change) { |
|
| 332 | 332 | $changed = (isset($change['from']) && isset($change['to'])) ? $change['from'] != $change['to'] : null; |
| 333 | 333 | $description = isset($change['description']) ? $change['description'] : ''; |
| 334 | 334 | $compareUrl = null; |
@@ -378,11 +378,11 @@ discard block |
||
| 378 | 378 | // Make sure we use the SHA as it was written into this DNDeployment. |
| 379 | 379 | $args['sha'] = $this->SHA; |
| 380 | 380 | |
| 381 | - if(!$this->DeployerID) { |
|
| 381 | + if (!$this->DeployerID) { |
|
| 382 | 382 | $this->DeployerID = Member::currentUserID(); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if($this->DeployerID) { |
|
| 385 | + if ($this->DeployerID) { |
|
| 386 | 386 | $deployer = $this->Deployer(); |
| 387 | 387 | $message = sprintf( |
| 388 | 388 | 'Deploy to %s initiated by %s (%s), with IP address %s', |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $cache = self::get_git_cache(); |
| 163 | 163 | // we only need to clear the tag cache since everything else is cached by SHA, that is for commit and |
| 164 | 164 | // commit message. |
| 165 | - $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 165 | + $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | return true; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 336 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 337 | 337 | return $env->canRestore($member); |
| 338 | 338 | })->Count(); |
| 339 | 339 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return true; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 357 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 358 | 358 | return $env->canBackup($member); |
| 359 | 359 | })->Count(); |
| 360 | 360 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | return true; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 378 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 379 | 379 | return $env->canUploadArchive($member); |
| 380 | 380 | })->Count(); |
| 381 | 381 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | return true; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - return (bool) $this->Environments()->filterByCallback(function ($env) use ($member) { |
|
| 399 | + return (bool) $this->Environments()->filterByCallback(function($env) use ($member) { |
|
| 400 | 400 | return $env->canDownloadArchive($member); |
| 401 | 401 | })->Count(); |
| 402 | 402 | } |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | // Key-pair is available, use it. |
| 456 | 456 | $processEnv = [ |
| 457 | 457 | 'IDENT_KEY' => $this->getPrivateKeyPath(), |
| 458 | - 'GIT_SSH' => BASE_PATH . "/deploynaut/git-deploy.sh" |
|
| 458 | + 'GIT_SSH' => BASE_PATH."/deploynaut/git-deploy.sh" |
|
| 459 | 459 | ]; |
| 460 | 460 | } else { |
| 461 | 461 | $processEnv = []; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | $currentMember = self::$_current_member_cache; |
| 545 | 545 | return $this->Environments() |
| 546 | - ->filterByCallBack(function ($item) use ($currentMember) { |
|
| 546 | + ->filterByCallBack(function($item) use ($currentMember) { |
|
| 547 | 547 | return $item->canView($currentMember); |
| 548 | 548 | }); |
| 549 | 549 | } |
@@ -562,14 +562,14 @@ discard block |
||
| 562 | 562 | * @return false|DNDeployment |
| 563 | 563 | */ |
| 564 | 564 | public function currentBuilds() { |
| 565 | - if (!isset(self::$relation_cache['currentBuilds.' . $this->ID])) { |
|
| 565 | + if (!isset(self::$relation_cache['currentBuilds.'.$this->ID])) { |
|
| 566 | 566 | $currentBuilds = []; |
| 567 | 567 | foreach ($this->Environments() as $env) { |
| 568 | 568 | $currentBuilds[$env->Name] = $env->CurrentBuild(); |
| 569 | 569 | } |
| 570 | - self::$relation_cache['currentBuilds.' . $this->ID] = $currentBuilds; |
|
| 570 | + self::$relation_cache['currentBuilds.'.$this->ID] = $currentBuilds; |
|
| 571 | 571 | } |
| 572 | - return self::$relation_cache['currentBuilds.' . $this->ID]; |
|
| 572 | + return self::$relation_cache['currentBuilds.'.$this->ID]; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | public function getPublicKeyPath() { |
| 825 | 825 | if ($privateKey = $this->getPrivateKeyPath()) { |
| 826 | - return $privateKey . '.pub'; |
|
| 826 | + return $privateKey.'.pub'; |
|
| 827 | 827 | } |
| 828 | 828 | return null; |
| 829 | 829 | } |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | if (!empty($keyDir)) { |
| 839 | 839 | $filter = FileNameFilter::create(); |
| 840 | 840 | $name = $filter->filter($this->Name); |
| 841 | - return $keyDir . '/' . $name; |
|
| 841 | + return $keyDir.'/'.$name; |
|
| 842 | 842 | } |
| 843 | 843 | return null; |
| 844 | 844 | } |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $filter = FileNameFilter::create(); |
| 858 | 858 | $name = $filter->filter($this->Name); |
| 859 | 859 | |
| 860 | - return $this->DNData()->getKeyDir() . '/' . $name; |
|
| 860 | + return $this->DNData()->getKeyDir().'/'.$name; |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | /** |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | /* Look for each whitelisted hostname */ |
| 884 | 884 | foreach ($interfaces as $host => $interface) { |
| 885 | 885 | /* See if the CVS Path is for this hostname, followed by some junk (maybe a port), then the path */ |
| 886 | - if (preg_match('{^[^.]*' . $host . '(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 886 | + if (preg_match('{^[^.]*'.$host.'(.*?)([/a-zA-Z].+)}', $this->CVSPath, $match)) { |
|
| 887 | 887 | |
| 888 | 888 | $path = $match[2]; |
| 889 | 889 | |
@@ -894,10 +894,10 @@ discard block |
||
| 894 | 894 | $components = explode('.', $host); |
| 895 | 895 | |
| 896 | 896 | foreach ($regex as $pattern => $replacement) { |
| 897 | - $path = preg_replace('/' . $pattern . '/', $replacement, $path); |
|
| 897 | + $path = preg_replace('/'.$pattern.'/', $replacement, $path); |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | - $uxurl = Controller::join_links($scheme . '://', $host, $path); |
|
| 900 | + $uxurl = Controller::join_links($scheme.'://', $host, $path); |
|
| 901 | 901 | |
| 902 | 902 | if (array_key_exists('commit', $interface) && $interface['commit'] == false) { |
| 903 | 903 | $commiturl = false; |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | // {@see DataObject::extendedCan()} |
| 1025 | 1025 | $isDone = $this->extend('isProjectReady'); |
| 1026 | 1026 | if ($isDone && is_array($isDone)) { |
| 1027 | - $isDone = array_filter($isDone, function ($val) { |
|
| 1027 | + $isDone = array_filter($isDone, function($val) { |
|
| 1028 | 1028 | return !is_null($val); |
| 1029 | 1029 | }); |
| 1030 | 1030 | |
@@ -1109,11 +1109,11 @@ discard block |
||
| 1109 | 1109 | return false; |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | - $cachekey = $this->ID . '_commit_' . $sha; |
|
| 1112 | + $cachekey = $this->ID.'_commit_'.$sha; |
|
| 1113 | 1113 | $cache = self::get_git_cache(); |
| 1114 | 1114 | if (!($result = $cache->load($cachekey))) { |
| 1115 | 1115 | $result = $repo->getCommit($sha); |
| 1116 | - $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_' . $this->ID]); |
|
| 1116 | + $cache->save($result, $cachekey, ['gitonomy', 'commit', 'project_'.$this->ID]); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | return $result; |
| 1119 | 1119 | } |
@@ -1123,11 +1123,11 @@ discard block |
||
| 1123 | 1123 | * @return string |
| 1124 | 1124 | */ |
| 1125 | 1125 | public function getCommitMessage(\Gitonomy\Git\Commit $commit) { |
| 1126 | - $cachekey = $this->ID . '_message_' . $commit->getRevision(); |
|
| 1126 | + $cachekey = $this->ID.'_message_'.$commit->getRevision(); |
|
| 1127 | 1127 | $cache = self::get_git_cache(); |
| 1128 | 1128 | if (!($result = $cache->load($cachekey))) { |
| 1129 | 1129 | $result = $commit->getMessage(); |
| 1130 | - $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_' . $this->ID]); |
|
| 1130 | + $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_'.$this->ID]); |
|
| 1131 | 1131 | } |
| 1132 | 1132 | return $result; |
| 1133 | 1133 | } |
@@ -1139,11 +1139,11 @@ discard block |
||
| 1139 | 1139 | * @return string |
| 1140 | 1140 | */ |
| 1141 | 1141 | public function getCommitSubjectMessage(\Gitonomy\Git\Commit $commit) { |
| 1142 | - $cachekey = $this->ID . '_message_subject' . $commit->getRevision(); |
|
| 1142 | + $cachekey = $this->ID.'_message_subject'.$commit->getRevision(); |
|
| 1143 | 1143 | $cache = self::get_git_cache(); |
| 1144 | 1144 | if (!($result = $cache->load($cachekey))) { |
| 1145 | 1145 | $result = $commit->getSubjectMessage(); |
| 1146 | - $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_' . $this->ID]); |
|
| 1146 | + $cache->save($result, $cachekey, ['gitonomy', 'message', 'project_'.$this->ID]); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | return $result; |
| 1149 | 1149 | } |
@@ -1153,14 +1153,14 @@ discard block |
||
| 1153 | 1153 | * @return mixed |
| 1154 | 1154 | */ |
| 1155 | 1155 | public function getCommitTags(\Gitonomy\Git\Commit $commit) { |
| 1156 | - $cachekey = $this->ID . '_tags_' . $commit->getRevision(); |
|
| 1156 | + $cachekey = $this->ID.'_tags_'.$commit->getRevision(); |
|
| 1157 | 1157 | $cache = self::get_git_cache(); |
| 1158 | 1158 | $result = $cache->load($cachekey); |
| 1159 | 1159 | // we check against false, because in many cases the tag list is an empty array |
| 1160 | 1160 | if ($result === false) { |
| 1161 | 1161 | $repo = $this->getRepository(); |
| 1162 | 1162 | $result = $repo->getReferences()->resolveTags($commit->getRevision()); |
| 1163 | - $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_' . $this->ID]); |
|
| 1163 | + $cache->save($result, $cachekey, ['gitonomy', 'tags', 'project_'.$this->ID]); |
|
| 1164 | 1164 | } |
| 1165 | 1165 | return $result; |
| 1166 | 1166 | } |