• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ConduitAPIRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ConduitAPIRequest的典型用法代码示例。如果您正苦于以下问题:PHP ConduitAPIRequest类的具体用法?PHP ConduitAPIRequest怎么用?PHP ConduitAPIRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ConduitAPIRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(ConduitAPIRequest $conduit_request)
 {
     $revision_phids = $conduit_request->getValue('revisionPHIDs');
     $requested_commit_phids = $conduit_request->getValue('requestedCommitPHIDs');
     $result = array();
     if (!$revision_phids && !$requested_commit_phids) {
         return $result;
     }
     $query = new ReleephRequestQuery();
     $query->setViewer($conduit_request->getUser());
     if ($revision_phids) {
         $query->withRequestedObjectPHIDs($revision_phids);
     } else {
         if ($requested_commit_phids) {
             $query->withRequestedCommitPHIDs($requested_commit_phids);
         }
     }
     $releeph_requests = $query->execute();
     foreach ($releeph_requests as $releeph_request) {
         $branch = $releeph_request->getBranch();
         $request_commit_phid = $releeph_request->getRequestCommitPHID();
         $object = $releeph_request->getRequestedObject();
         if ($object instanceof DifferentialRevision) {
             $object_phid = $object->getPHID();
         } else {
             $object_phid = null;
         }
         $status = $releeph_request->getStatus();
         $status_name = ReleephRequestStatus::getStatusDescriptionFor($status);
         $url = PhabricatorEnv::getProductionURI('/RQ' . $releeph_request->getID());
         $result[] = array('branchBasename' => $branch->getBasename(), 'branchSymbolic' => $branch->getSymbolicName(), 'requestID' => $releeph_request->getID(), 'revisionPHID' => $object_phid, 'status' => $status, 'status_name' => $status_name, 'url' => $url);
     }
     return $result;
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:34,代码来源:ReleephQueryRequestsConduitAPIMethod.php


示例2: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $diff_id = $request->getValue('diff_id');
     $name = $request->getValue('name');
     $data = json_decode($request->getValue('data'), true);
     self::updateDiffProperty($diff_id, $name, $data);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialSetDiffPropertyConduitAPIMethod.php


示例3: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $phid = $request->getValue('objectPHID');
     // NOTE: We use withNames() to let monograms like "D123" work, which makes
     // this a little easier to test. Real PHIDs will still work as expected.
     $object = id(new PhabricatorObjectQuery())->setViewer($viewer)->withNames(array($phid))->executeOne();
     if (!$object) {
         throw new Exception(pht('No such object "%s" exists.', $phid));
     }
     if (!$object instanceof HarbormasterBuildableInterface) {
         throw new Exception(pht('Object "%s" does not implement interface "%s". Autotargets may ' . 'only be queried for buildable objects.', $phid, 'HarbormasterBuildableInterface'));
     }
     $autotargets = $request->getValue('targetKeys', array());
     if ($autotargets) {
         $targets = id(new HarbormasterTargetEngine())->setViewer($viewer)->setObject($object)->setAutoTargetKeys($autotargets)->buildTargets();
     } else {
         $targets = array();
     }
     // Reorder the results according to the request order so we can make test
     // assertions that subsequent calls return the same results.
     $map = mpull($targets, 'getPHID');
     $map = array_select_keys($map, $autotargets);
     return array('targetMap' => $map);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:HarbormasterQueryAutotargetsConduitAPIMethod.php


示例4: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $name = $request->getValue('name');
     $name_prefix = $request->getValue('namePrefix');
     $language = $request->getValue('language');
     $type = $request->getValue('type');
     $query = new DiffusionSymbolQuery();
     if ($name !== null) {
         $query->setName($name);
     }
     if ($name_prefix !== null) {
         $query->setNamePrefix($name_prefix);
     }
     if ($language !== null) {
         $query->setLanguage($language);
     }
     if ($type !== null) {
         $query->setType($type);
     }
     $query->needPaths(true);
     $query->needArcanistProjects(true);
     $query->needRepositories(true);
     $results = $query->execute();
     $response = array();
     foreach ($results as $result) {
         $response[] = array('name' => $result->getSymbolName(), 'type' => $result->getSymbolType(), 'language' => $result->getSymbolLanguage(), 'path' => $result->getPath(), 'line' => $result->getLineNumber(), 'uri' => PhabricatorEnv::getProductionURI($result->getURI()));
     }
     return $response;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:29,代码来源:ConduitAPI_diffusion_findsymbols_Method.php


示例5: getResult

 protected function getResult(ConduitAPIRequest $request)
 {
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     if (!$repository->isGit()) {
         throw new Exception(pht('This API method can only be called on Git repositories.'));
     }
     // Check if the commit has parents. We're testing to see whether it is the
     // first commit in history (in which case we must use "git log") or some
     // other commit (in which case we can use "git diff"). We'd rather use
     // "git diff" because it has the right behavior for merge commits, but
     // it requires the commit to have a parent that we can diff against. The
     // first commit doesn't, so "commit^" is not a valid ref.
     list($parents) = $repository->execxLocalCommand('log -n1 --format=%s %s', '%P', $request->getValue('commit'));
     $use_log = !strlen(trim($parents));
     if ($use_log) {
         // This is the first commit so we need to use "log". We know it's not a
         // merge commit because it couldn't be merging anything, so this is safe.
         // NOTE: "--pretty=format: " is to disable diff output, we only want the
         // part we get from "--raw".
         list($raw) = $repository->execxLocalCommand('log -n1 -M -C -B --find-copies-harder --raw -t ' . '--pretty=format: --abbrev=40 %s', $request->getValue('commit'));
     } else {
         // Otherwise, we can use "diff", which will give us output for merges.
         // We diff against the first parent, as this is generally the expectation
         // and results in sensible behavior.
         list($raw) = $repository->execxLocalCommand('diff -n1 -M -C -B --find-copies-harder --raw -t ' . '--abbrev=40 %s^1 %s', $request->getValue('commit'), $request->getValue('commit'));
     }
     return $raw;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:29,代码来源:DiffusionInternalGitRawDiffQueryConduitAPIMethod.php


示例6: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $id = $request->getValue('id');
     $object = $request->getValue('objectPHID');
     if ($id) {
         $flag = id(new PhabricatorFlag())->load($id);
         if (!$flag) {
             throw new ConduitException('ERR_NOT_FOUND');
         }
         if ($flag->getOwnerPHID() != $request->getUser()->getPHID()) {
             throw new ConduitException('ERR_WRONG_USER');
         }
     } elseif ($object) {
         $flag = id(new PhabricatorFlag())->loadOneWhere('objectPHID = %s AND ownerPHID = %s', $object, $request->getUser()->getPHID());
         if (!$flag) {
             return null;
         }
     } else {
         throw new ConduitException('ERR_NEED_PARAM');
     }
     $this->attachHandleToFlag($flag);
     $ret = $this->buildFlagInfoDictionary($flag);
     $flag->delete();
     return $ret;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:25,代码来源:ConduitAPI_flag_delete_Method.php


示例7: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $results = array();
     $revision_ids = $request->getValue('ids');
     if (!$revision_ids) {
         return $results;
     }
     $revisions = id(new DifferentialRevisionQuery())->setViewer($viewer)->withIDs($revision_ids)->execute();
     if (!$revisions) {
         return $results;
     }
     $xactions = id(new DifferentialTransactionQuery())->setViewer($viewer)->withObjectPHIDs(mpull($revisions, 'getPHID'))->execute();
     $revisions = mpull($revisions, null, 'getPHID');
     foreach ($xactions as $xaction) {
         $revision = idx($revisions, $xaction->getObjectPHID());
         if (!$revision) {
             continue;
         }
         $type = $xaction->getTransactionType();
         if ($type == DifferentialTransaction::TYPE_ACTION) {
             $action = $xaction->getNewValue();
         } else {
             if ($type == PhabricatorTransactions::TYPE_COMMENT) {
                 $action = 'comment';
             } else {
                 $action = 'none';
             }
         }
         $result = array('revisionID' => $revision->getID(), 'action' => $action, 'authorPHID' => $xaction->getAuthorPHID(), 'dateCreated' => $xaction->getDateCreated(), 'content' => $xaction->hasComment() ? $xaction->getComment()->getContent() : null);
         $results[$revision->getID()][] = $result;
     }
     return $results;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:34,代码来源:DifferentialGetRevisionCommentsConduitAPIMethod.php


示例8: getMercurialResult

 protected function getMercurialResult(ConduitAPIRequest $request)
 {
     $drequest = $this->getDiffusionRequest();
     $path = $drequest->getPath();
     $grep = $request->getValue('grep');
     $repository = $drequest->getRepository();
     $limit = $request->getValue('limit');
     $offset = $request->getValue('offset');
     $results = array();
     $future = $repository->getLocalCommandFuture('grep --rev %s --print0 --line-number %s %s', hgsprintf('ancestors(%s)', $drequest->getStableCommit()), $grep, $path);
     $lines = id(new LinesOfALargeExecFuture($future))->setDelimiter("");
     $parts = array();
     foreach ($lines as $line) {
         $parts[] = $line;
         if (count($parts) == 4) {
             list($path, $char_offset, $line, $string) = $parts;
             $results[] = array($path, $line, $string);
             if (count($results) >= $offset + $limit) {
                 break;
             }
             $parts = array();
         }
     }
     unset($lines);
     return $results;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:26,代码来源:DiffusionSearchQueryConduitAPIMethod.php


示例9: execute

 /**
  * This method is final because most queries will need to construct a
  * @{class:DiffusionRequest} and use it. Consolidating this codepath and
  * enforcing @{method:getDiffusionRequest} works when we need it is good.
  *
  * @{method:getResult} should be overridden by subclasses as necessary, e.g.
  * there is a common operation across all version control systems that
  * should occur after @{method:getResult}, like formatting a timestamp.
  */
 protected final function execute(ConduitAPIRequest $request)
 {
     $identifier = $request->getValue('repository');
     if ($identifier === null) {
         $identifier = $request->getValue('callsign');
     }
     $drequest = DiffusionRequest::newFromDictionary(array('user' => $request->getUser(), 'repository' => $identifier, 'branch' => $request->getValue('branch'), 'path' => $request->getValue('path'), 'commit' => $request->getValue('commit')));
     if (!$drequest) {
         throw new Exception(pht('Repository "%s" is not a valid repository.', $identifier));
     }
     // Figure out whether we're going to handle this request on this device,
     // or proxy it to another node in the cluster.
     // If this is a cluster request and we need to proxy, we'll explode here
     // to prevent infinite recursion.
     $is_cluster_request = $request->getIsClusterRequest();
     $repository = $drequest->getRepository();
     $client = $repository->newConduitClient($request->getUser(), $is_cluster_request);
     if ($client) {
         // We're proxying, so just make an intracluster call.
         return $client->callMethodSynchronous($this->getAPIMethodName(), $request->getAllParameters());
     } else {
         // We pass this flag on to prevent proxying of any other Conduit calls
         // which we need to make in order to respond to this one. Although we
         // could safely proxy them, we take a big performance hit in the common
         // case, and doing more proxying wouldn't exercise any additional code so
         // we wouldn't gain a testability/predictability benefit.
         $drequest->setIsClusterRequest($is_cluster_request);
         $this->setDiffusionRequest($drequest);
         return $this->getResult($request);
     }
 }
开发者ID:truSense,项目名称:phabricator,代码行数:40,代码来源:DiffusionQueryConduitAPIMethod.php


示例10: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $raw_diff = $request->getValue('diff');
     $repository_phid = $request->getValue('repositoryPHID');
     if ($repository_phid) {
         $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withPHIDs(array($repository_phid))->executeOne();
         if (!$repository) {
             throw new Exception(pht('No such repository "%s"!', $repository_phid));
         }
     } else {
         $repository = null;
     }
     $parser = new ArcanistDiffParser();
     $changes = $parser->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     $diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
     $diff->setUnitStatus(DifferentialUnitStatus::UNIT_SKIP);
     $diff->setAuthorPHID($viewer->getPHID());
     $diff->setCreationMethod('web');
     if ($repository) {
         $diff->setRepositoryPHID($repository->getPHID());
     }
     id(new DifferentialDiffEditor())->setActor($viewer)->setContentSource(PhabricatorContentSource::newFromConduitRequest($request))->saveDiff($diff);
     return $this->buildDiffInfoDictionary($diff);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:26,代码来源:DifferentialCreateRawDiffConduitAPIMethod.php


示例11: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $diff = null;
     $revision_id = $request->getValue('revision_id');
     if ($revision_id) {
         $revision = id(new DifferentialRevision())->load($revision_id);
         if (!$revision) {
             throw new ConduitException('ERR_BAD_REVISION');
         }
         $diff = id(new DifferentialDiff())->loadOneWhere('revisionID = %d ORDER BY id DESC LIMIT 1', $revision->getID());
     } else {
         $diff_id = $request->getValue('diff_id');
         if ($diff_id) {
             $diff = id(new DifferentialDiff())->load($diff_id);
         }
     }
     if (!$diff) {
         throw new ConduitException('ERR_BAD_DIFF');
     }
     $diff->attachChangesets($diff->loadRelatives(new DifferentialChangeset(), 'diffID'));
     foreach ($diff->getChangesets() as $changeset) {
         $changeset->attachHunks($changeset->loadRelatives(new DifferentialHunk(), 'changesetID'));
     }
     $basic_dict = $diff->getDiffDict();
     // for conduit calls, the basic dict is not enough
     // we also need to include the arcanist project
     $project = $diff->loadArcanistProject();
     if ($project) {
         $project_name = $project->getName();
     } else {
         $project_name = null;
     }
     $basic_dict['projectName'] = $project_name;
     return $basic_dict;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:35,代码来源:ConduitAPI_differential_getdiff_Method.php


示例12: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $user_phid = $request->getUser()->getPHID();
     $from = $request->getValue('fromEpoch');
     $to = $request->getValue('toEpoch');
     if ($to <= $from) {
         throw new ConduitException('ERR-BAD-EPOCH');
     }
     $table = new PhabricatorCalendarEvent();
     $table->openTransaction();
     $table->beginReadLocking();
     $overlap = $table->loadAllWhere('userPHID = %s AND dateFrom < %d AND dateTo > %d', $user_phid, $to, $from);
     foreach ($overlap as $status) {
         if ($status->getDateFrom() < $from) {
             if ($status->getDateTo() > $to) {
                 // Split the interval.
                 id(new PhabricatorCalendarEvent())->setUserPHID($user_phid)->setDateFrom($to)->setDateTo($status->getDateTo())->setStatus($status->getStatus())->setDescription($status->getDescription())->save();
             }
             $status->setDateTo($from);
             $status->save();
         } else {
             if ($status->getDateTo() > $to) {
                 $status->setDateFrom($to);
                 $status->save();
             } else {
                 $status->delete();
             }
         }
     }
     $table->endReadLocking();
     $table->saveTransaction();
     return count($overlap);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:33,代码来源:UserRemoveStatusConduitAPIMethod.php


示例13: processBranchRefs

 private function processBranchRefs(ConduitAPIRequest $request, array $refs)
 {
     $drequest = $this->getDiffusionRequest();
     $repository = $drequest->getRepository();
     $offset = $request->getValue('offset');
     $limit = $request->getValue('limit');
     foreach ($refs as $key => $ref) {
         if (!$repository->shouldTrackBranch($ref->getShortName())) {
             unset($refs[$key]);
         }
     }
     $with_closed = $request->getValue('closed');
     if ($with_closed !== null) {
         foreach ($refs as $key => $ref) {
             $fields = $ref->getRawFields();
             if (idx($fields, 'closed') != $with_closed) {
                 unset($refs[$key]);
             }
         }
     }
     // NOTE: We can't apply the offset or limit until here, because we may have
     // filtered untrackable branches out of the result set.
     if ($offset) {
         $refs = array_slice($refs, $offset);
     }
     if ($limit) {
         $refs = array_slice($refs, 0, $limit);
     }
     return mpull($refs, 'toDictionary');
 }
开发者ID:pugong,项目名称:phabricator,代码行数:30,代码来源:DiffusionBranchQueryConduitAPIMethod.php


示例14: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $results = array();
     $revision_ids = $request->getValue('ids');
     if (!$revision_ids) {
         return $results;
     }
     $comments = id(new DifferentialComment())->loadAllWhere('revisionID IN (%Ld)', $revision_ids);
     $with_inlines = $request->getValue('inlines');
     if ($with_inlines) {
         $inlines = id(new DifferentialInlineComment())->loadAllWhere('revisionID IN (%Ld)', $revision_ids);
         $changesets = array();
         if ($inlines) {
             $changesets = id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', array_unique(mpull($inlines, 'getChangesetID')));
             $inlines = mgroup($inlines, 'getCommentID');
         }
     }
     foreach ($comments as $comment) {
         $revision_id = $comment->getRevisionID();
         $result = array('revisionID' => $revision_id, 'action' => $comment->getAction(), 'authorPHID' => $comment->getAuthorPHID(), 'dateCreated' => $comment->getDateCreated(), 'content' => $comment->getContent());
         if ($with_inlines) {
             $result['inlines'] = array();
             foreach (idx($inlines, $comment->getID(), array()) as $inline) {
                 $changeset = idx($changesets, $inline->getChangesetID());
                 $result['inlines'][] = $this->buildInlineInfoDictionary($inline, $changeset);
             }
             // TODO: Put synthetic inlines without an attached comment somewhere.
         }
         $results[$revision_id][] = $result;
     }
     return $results;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:32,代码来源:ConduitAPI_differential_getrevisioncomments_Method.php


示例15: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $paths = $request->getValue('paths');
     $fragments = id(new PhragmentFragmentQuery())->setViewer($request->getUser())->withPaths($paths)->execute();
     $fragments = mpull($fragments, null, 'getPath');
     foreach ($paths as $path) {
         if (!array_key_exists($path, $fragments)) {
             throw new ConduitException('ERR_BAD_FRAGMENT');
         }
     }
     $results = array();
     foreach ($fragments as $path => $fragment) {
         $mappings = $fragment->getFragmentMappings($request->getUser(), $fragment->getPath());
         $file_phids = mpull(mpull($mappings, 'getLatestVersion'), 'getFilePHID');
         $files = id(new PhabricatorFileQuery())->setViewer($request->getUser())->withPHIDs($file_phids)->execute();
         $files = mpull($files, null, 'getPHID');
         $result = array();
         foreach ($mappings as $cpath => $child) {
             $file_phid = $child->getLatestVersion()->getFilePHID();
             if (!isset($files[$file_phid])) {
                 // Skip any files we don't have permission to access.
                 continue;
             }
             $file = $files[$file_phid];
             $cpath = substr($child->getPath(), strlen($fragment->getPath()) + 1);
             $result[] = array('phid' => $child->getPHID(), 'phidVersion' => $child->getLatestVersionPHID(), 'path' => $cpath, 'hash' => $file->getContentHash(), 'version' => $child->getLatestVersion()->getSequence(), 'uri' => $file->getViewURI());
         }
         $results[$path] = $result;
     }
     return $results;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:31,代码来源:PhragmentQueryFragmentsConduitAPIMethod.php


示例16: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $user = $request->getUser();
     $this->requireApplicationCapability(ProjectCreateProjectsCapability::CAPABILITY, $user);
     $history = id(new SprintQuery())->setViewer($user)->getTaskHistory($request->getValue('project'));
     return $history;
 }
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:7,代码来源:SprintGetTaskProjectHistoryConduitAPIMethod.php


示例17: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $logs = $request->getValue('logs');
     if (!is_array($logs)) {
         $logs = array();
     }
     $template = new PhabricatorChatLogEvent();
     $template->setLoggedByPHID($request->getUser()->getPHID());
     $objs = array();
     foreach ($logs as $log) {
         $channel_name = idx($log, 'channel');
         $service_name = idx($log, 'serviceName');
         $service_type = idx($log, 'serviceType');
         $channel = id(new PhabricatorChatLogChannel())->loadOneWhere('channelName = %s AND serviceName = %s AND serviceType = %s', $channel_name, $service_name, $service_type);
         if (!$channel) {
             $channel = id(new PhabricatorChatLogChannel())->setChannelName($channel_name)->setserviceName($service_name)->setServiceType($service_type)->setViewPolicy(PhabricatorPolicies::POLICY_USER)->setEditPolicy(PhabricatorPolicies::POLICY_USER)->save();
         }
         $obj = clone $template;
         $obj->setChannelID($channel->getID());
         $obj->setType(idx($log, 'type'));
         $obj->setAuthor(idx($log, 'author'));
         $obj->setEpoch(idx($log, 'epoch'));
         $obj->setMessage(idx($log, 'message'));
         $obj->save();
         $objs[] = $obj;
     }
     return array_values(mpull($objs, 'getID'));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:28,代码来源:ChatLogRecordConduitAPIMethod.php


示例18: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $source = $request->getValue('code');
     $future = xhpast_get_parser_future($source);
     list($stdout) = $future->resolvex();
     return json_decode($stdout, true);
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:7,代码来源:ConduitAPI_phpast_getast_Method.php


示例19: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $corpus = $request->getValue('corpus');
     $is_partial = $request->getValue('partial');
     $revision = new DifferentialRevision();
     $field_list = PhabricatorCustomField::getObjectFields($revision, DifferentialCustomField::ROLE_COMMITMESSAGE);
     $field_list->setViewer($viewer);
     $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit');
     $this->errors = array();
     $label_map = $this->buildLabelMap($field_list);
     $corpus_map = $this->parseCommitMessage($corpus, $label_map);
     $values = array();
     foreach ($corpus_map as $field_key => $text_value) {
         $field = idx($field_map, $field_key);
         if (!$field) {
             throw new Exception(pht('Parser emitted text value for field key "%s", but no such ' . 'field exists.', $field_key));
         }
         try {
             $values[$field_key] = $field->parseValueFromCommitMessage($text_value);
         } catch (DifferentialFieldParseException $ex) {
             $this->errors[] = pht('Error parsing field "%s": %s', $field->renderCommitMessageLabel(), $ex->getMessage());
         }
     }
     if (!$is_partial) {
         foreach ($field_map as $key => $field) {
             try {
                 $field->validateCommitMessageValue(idx($values, $key));
             } catch (DifferentialFieldValidationException $ex) {
                 $this->errors[] = pht('Invalid or missing field "%s": %s', $field->renderCommitMessageLabel(), $ex->getMessage());
             }
         }
     }
     return array('errors' => $this->errors, 'fields' => $values);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:DifferentialParseCommitMessageConduitAPIMethod.php


示例20: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $corpus = $request->getValue('corpus');
     $aux_fields = DifferentialFieldSelector::newSelector()->getFieldSpecifications();
     foreach ($aux_fields as $key => $aux_field) {
         if (!$aux_field->shouldAppearOnCommitMessage()) {
             unset($aux_fields[$key]);
         }
     }
     $aux_fields = mpull($aux_fields, null, 'getCommitMessageKey');
     // Build a map from labels (like "Test Plan") to field keys
     // (like "testPlan").
     $label_map = $this->buildLabelMap($aux_fields);
     $field_map = $this->parseCommitMessage($corpus, $label_map);
     $fields = array();
     $errors = array();
     foreach ($field_map as $field_key => $field_value) {
         $field = $aux_fields[$field_key];
         try {
             $fields[$field_key] = $field->parseValueFromCommitMessage($field_value);
         } catch (DifferentialFieldParseException $ex) {
             $field_label = $field->renderLabelForCommitMessage();
             $errors[] = "Error parsing field '{$field_label}': " . $ex->getMessage();
         }
     }
     // TODO: This is for backcompat only, remove once Arcanist gets updated.
     $error = head($errors);
     return array('error' => $error, 'errors' => $errors, 'fields' => $fields);
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:29,代码来源:ConduitAPI_differential_parsecommitmessage_Method.php



注:本文中的ConduitAPIRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Coneccion类代码示例发布时间:2022-05-20
下一篇:
PHP Condition类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap