Merge pull request #223 from deep9/issue_221_gitlab

Proposed enhancement - fix for #221 GitlabBuild
This commit is contained in:
Mark Clements 2013-11-27 03:38:39 -08:00
commit 12cca9c93c
2 changed files with 14 additions and 6 deletions

View file

@ -215,11 +215,19 @@ class ProjectBase extends Model
/**
* Get the value of AccessInformation / access_information.
*
* @param string|null $key Key of desired information
*
* @return string
*/
public function getAccessInformation()
public function getAccessInformation($key = null)
{
$rtn = $this->data['access_information'];
if (is_null($key)) {
$rtn = $this->data['access_information'];
} else if (isset($this->data['access_information'][$key])) {
$rtn = $this->data['access_information'][$key];
} else {
$rtn = null;
}
return $rtn;
}

View file

@ -25,7 +25,7 @@ class GitlabBuild extends RemoteGitBuild
*/
public function getCommitLink()
{
$domain = $this->getProject()->getAccessInformation()["domain"];
$domain = $this->getProject()->getAccessInformation("domain");
return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/commit/' . $this->getCommitId();
}
@ -34,7 +34,7 @@ class GitlabBuild extends RemoteGitBuild
*/
public function getBranchLink()
{
$domain = $this->getProject()->getAccessInformation()["domain"];
$domain = $this->getProject()->getAccessInformation("domain");
return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/tree/' . $this->getBranch();
}
@ -46,8 +46,8 @@ class GitlabBuild extends RemoteGitBuild
$key = trim($this->getProject()->getGitKey());
if (!empty($key)) {
$user = $this->getProject()->getAccessInformation()["user"];
$domain = $this->getProject()->getAccessInformation()["domain"];
$user = $this->getProject()->getAccessInformation("user");
$domain = $this->getProject()->getAccessInformation("domain");
return $user . '@' . $domain . ':' . $this->getProject()->getReference() . '.git';
}
}