Inheritance: extends ViewableData
Ejemplo n.º 1
0
 /**
  * @return array()
  */
 protected function getReferences()
 {
     $branches = array();
     // Placeholder to put master branch first
     $firstBranch = null;
     // return an empty array if the version control isn't checked out yet
     if (!file_exists($this->project->LocalCVSPath)) {
         return array();
     }
     $repository = new Gitonomy\Git\Repository($this->project->LocalCVSPath);
     foreach ($repository->getReferences()->getBranches() as $branch) {
         $obj = DNBranch::create($branch, $this->project, $this->data);
         if ($branch->getName() == 'master') {
             $firstBranch = array($branch->getName() => $obj);
         } else {
             $branches[$branch->getName()] = $obj;
         }
     }
     if ($firstBranch) {
         $branches = $firstBranch + $branches;
     }
     return $branches;
 }
Ejemplo n.º 2
0
 /**
  * @return array
  */
 protected function getReferences()
 {
     $branches = array();
     // Placeholder to put master branch first
     $firstBranch = null;
     try {
         $repository = new Gitonomy\Git\Repository($this->project->getLocalCVSPath());
     } catch (Exception $e) {
         return $branches;
     }
     foreach ($repository->getReferences()->getBranches() as $branch) {
         /** @var DNBranch $obj */
         $obj = DNBranch::create($branch, $this->project, $this->data);
         if ($branch->getName() == 'master') {
             $firstBranch = array($branch->getName() => $obj);
         } else {
             $branches[$branch->getName()] = $obj;
         }
     }
     if ($firstBranch) {
         $branches = $firstBranch + $branches;
     }
     return $branches;
 }