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


PHP ContextInterface::getCommitMessage方法代碼示例

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


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

示例1: run

 /**
  * @param ContextInterface|GitCommitMsgContext $context
  */
 public function run(ContextInterface $context)
 {
     $config = $this->getConfiguration();
     $commitMessage = $context->getCommitMessage();
     $exceptions = [];
     foreach ($config['matchers'] as $rule) {
         try {
             $this->runMatcher($config, $commitMessage, $rule);
         } catch (RuntimeException $e) {
             $exceptions[] = $e->getMessage();
         }
     }
     if (count($exceptions)) {
         return TaskResult::createFailed($this, $context, implode(PHP_EOL, $exceptions));
     }
     return TaskResult::createPassed($this, $context);
 }
開發者ID:phpro,項目名稱:grumphp,代碼行數:20,代碼來源:CommitMessage.php

示例2: run

 /**
  * @param ContextInterface|GitCommitMsgContext $context
  */
 public function run(ContextInterface $context)
 {
     $config = $this->getConfiguration();
     $commitMessage = $context->getCommitMessage();
     foreach ($config['matchers'] as $rule) {
         $regex = new Regex($rule);
         if ((bool) $config['case_insensitive']) {
             $regex->addPatternModifier('i');
         }
         if ((bool) $config['multiline']) {
             $regex->addPatternModifier('m');
         }
         if (!preg_match($regex->__toString(), $commitMessage)) {
             throw new RuntimeException(sprintf('The commit message does not match the rule: %s', $rule));
         }
     }
 }
開發者ID:aaa2000,項目名稱:grumphp,代碼行數:20,代碼來源:CommitMessage.php

示例3: run

 /**
  * @param ContextInterface|GitCommitMsgContext $context
  */
 public function run(ContextInterface $context)
 {
     $config = $this->getConfiguration();
     $commitMessage = $context->getCommitMessage();
     foreach ($config['matchers'] as $rule) {
         $expression = Expression::create($rule);
         $regex = $expression->getRegex();
         if ((bool) $config['case_insensitive']) {
             $regex->addOption('i');
         }
         if ((bool) $config['multiline']) {
             $regex->addOption('m');
         }
         if (!preg_match($regex->render(), $commitMessage)) {
             throw new RuntimeException(sprintf('The commit message does not match the rule: %s', $rule));
         }
     }
 }
開發者ID:hunslater,項目名稱:grumphp,代碼行數:21,代碼來源:CommitMessage.php


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