当前位置: 首页>>代码示例>>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;未经允许,请勿转载。