當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DiffusionRequest::getBranch方法代碼示例

本文整理匯總了PHP中DiffusionRequest::getBranch方法的典型用法代碼示例。如果您正苦於以下問題:PHP DiffusionRequest::getBranch方法的具體用法?PHP DiffusionRequest::getBranch怎麽用?PHP DiffusionRequest::getBranch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DiffusionRequest的用法示例。


在下文中一共展示了DiffusionRequest::getBranch方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: callConduitWithDiffusionRequest

 public static final function callConduitWithDiffusionRequest(PhabricatorUser $user, DiffusionRequest $drequest, $method, array $params = array())
 {
     $repository = $drequest->getRepository();
     $core_params = array('callsign' => $repository->getCallsign());
     if ($drequest->getBranch() !== null) {
         $core_params['branch'] = $drequest->getBranch();
     }
     $params = $params + $core_params;
     return id(new ConduitCall($method, $params))->setUser($user)->execute();
 }
開發者ID:denghp,項目名稱:phabricator,代碼行數:10,代碼來源:DiffusionQuery.php

示例2: callConduitWithDiffusionRequest

 public static final function callConduitWithDiffusionRequest(PhabricatorUser $user, DiffusionRequest $drequest, $method, array $params = array())
 {
     $repository = $drequest->getRepository();
     $core_params = array('repository' => $repository->getPHID());
     if ($drequest->getBranch() !== null) {
         $core_params['branch'] = $drequest->getBranch();
     }
     // If the method we're calling doesn't actually take some of the implicit
     // parameters we derive from the DiffusionRequest, omit them.
     $method_object = ConduitAPIMethod::getConduitMethod($method);
     $method_params = $method_object->getParamTypes();
     foreach ($core_params as $key => $value) {
         if (empty($method_params[$key])) {
             unset($core_params[$key]);
         }
     }
     $params = $params + $core_params;
     $client = $repository->newConduitClient($user, $drequest->getIsClusterRequest());
     if (!$client) {
         return id(new ConduitCall($method, $params))->setUser($user)->execute();
     } else {
         return $client->callMethodSynchronous($method, $params);
     }
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:24,代碼來源:DiffusionQuery.php

示例3: buildBranchListTable

 private function buildBranchListTable(DiffusionRequest $drequest)
 {
     $viewer = $this->getRequest()->getUser();
     if ($drequest->getBranch() === null) {
         return null;
     }
     $limit = 15;
     $branches = $this->callConduitWithDiffusionRequest('diffusion.branchquery', array('closed' => false, 'limit' => $limit + 1));
     if (!$branches) {
         return null;
     }
     $more_branches = count($branches) > $limit;
     $branches = array_slice($branches, 0, $limit);
     $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
     $commits = id(new DiffusionCommitQuery())->setViewer($viewer)->withIdentifiers(mpull($branches, 'getCommitIdentifier'))->withRepository($drequest->getRepository())->execute();
     $table = id(new DiffusionBranchTableView())->setUser($viewer)->setDiffusionRequest($drequest)->setBranches($branches)->setCommits($commits);
     $panel = new PHUIObjectBoxView();
     $header = new PHUIHeaderView();
     $header->setHeader(pht('Branches'));
     if ($more_branches) {
         $header->setSubHeader(pht('Showing %d branches.', $limit));
     }
     $icon = id(new PHUIIconView())->setIconFont('fa-code-fork');
     $button = new PHUIButtonView();
     $button->setText(pht('Show All Branches'));
     $button->setTag('a');
     $button->setIcon($icon);
     $button->setHref($drequest->generateURI(array('action' => 'branches')));
     $header->addActionLink($button);
     $panel->setHeader($header);
     $panel->setTable($table);
     return $panel;
 }
開發者ID:patelhardik,項目名稱:phabricator,代碼行數:33,代碼來源:DiffusionRepositoryController.php

示例4: buildBranchListTable

 private function buildBranchListTable(DiffusionRequest $drequest)
 {
     if ($drequest->getBranch() !== null) {
         $limit = 15;
         $branch_query = DiffusionBranchQuery::newFromDiffusionRequest($drequest);
         $branch_query->setLimit($limit + 1);
         $branches = $branch_query->loadBranches();
         if (!$branches) {
             return null;
         }
         $more_branches = count($branches) > $limit;
         $branches = array_slice($branches, 0, $limit);
         $commits = id(new PhabricatorAuditCommitQuery())->withIdentifiers($drequest->getRepository()->getID(), mpull($branches, 'getHeadCommitIdentifier'))->needCommitData(true)->execute();
         $table = new DiffusionBranchTableView();
         $table->setDiffusionRequest($drequest);
         $table->setBranches($branches);
         $table->setCommits($commits);
         $table->setUser($this->getRequest()->getUser());
         $panel = new AphrontPanelView();
         $panel->setHeader('Branches');
         if ($more_branches) {
             $panel->setCaption('Showing ' . $limit . ' branches.');
         }
         $panel->addButton(phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'branches')), 'class' => 'grey button'), "Show All Branches »"));
         $panel->appendChild($table);
         return $panel;
     }
     return null;
 }
開發者ID:relrod,項目名稱:phabricator,代碼行數:29,代碼來源:DiffusionRepositoryController.php


注:本文中的DiffusionRequest::getBranch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。