Ejemplo n.º 1
0
 public function convertProjectFromApi($projectApi)
 {
     if (!is_array($projectApi)) {
         return null;
     }
     $p = new Model\Project();
     $p->setRaw($projectApi)->setId($projectApi['id'])->setName($projectApi['name'])->setDescription($projectApi['description'])->setUrl($projectApi['web_url'])->setHttpGit($projectApi['http_url_to_repo'])->setSshGit($projectApi['ssh_url_to_repo']);
     return $p;
 }
Ejemplo n.º 2
0
 protected function fetchOneMergeRequestPage(Model\Project $project, $limit = self::PER_PAGE_DEFAULT, $offset = 0)
 {
     $page = $this->getPage($limit, $offset);
     $mrsApi = $this->getClient()->api('merge_requests')->all($project->getId(), $page, $limit);
     $mrs = array();
     foreach ($mrsApi as $mrApi) {
         $mr = $this->converter->convertMergeRequestFromApi($mrApi);
         $mr->setProject($project);
         $mrs[] = $mr;
         if (count($mrs) == $limit) {
             break;
         }
     }
     return $mrs;
 }
Ejemplo n.º 3
0
 /**
  * @param  \CleverAge\Orchestrator\Sources\Model\Project $project
  * @param  string $branchSource
  * @param  string $branchTarget
  * @return \CleverAge\Orchestrator\Sources\Model\MergeRequest|null
  */
 public function getMergeRequestBetween(Model\Project $project, $branchSource, $branchTarget)
 {
     return $this->getResource('doGetMergeRequestBetween', func_get_args(), array('cache_key' => 'mergerequests_' . $project->getId() . '_' . $branchSource . '_' . $branchTarget, 'cache_lifetime' => $this->cacheLifetime['mergerequest']));
 }