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