Inheritance: implements PhpGitHooks\Module\Configuration\Model\ToolInterface
コード例 #1
0
 /**
  * @param PreCommit             $preCommit
  * @param Composer              $composer
  * @param JsonLint              $jsonLint
  * @param PhpLint               $phpLint
  * @param PhpMd                 $phpMd
  * @param PhpCs                 $phpCs
  * @param PhpCsFixer            $phpCsFixer
  * @param PhpUnit               $phpUnit
  * @param PhpUnitStrictCoverage $phpUnitStrictCoverage
  * @param PhpUnitGuardCoverage  $phpUnitGuardCoverage
  * @param CommitMsg             $commitMsg
  * @param PrePush               $prePush
  * @param PhpUnit               $prePushPhpUnit
  * @param PhpUnitStrictCoverage $prePushStrictCoverage
  * @param PhpUnitGuardCoverage  $prePushGuardCoverage
  *
  * @return ConfigurationDataResponse
  */
 public static function build(PreCommit $preCommit, Composer $composer, JsonLint $jsonLint, PhpLint $phpLint, PhpMd $phpMd, PhpCs $phpCs, PhpCsFixer $phpCsFixer, PhpUnit $phpUnit, PhpUnitStrictCoverage $phpUnitStrictCoverage, PhpUnitGuardCoverage $phpUnitGuardCoverage, CommitMsg $commitMsg, PrePush $prePush, PhpUnit $prePushPhpUnit, PhpUnitStrictCoverage $prePushStrictCoverage, PhpUnitGuardCoverage $prePushGuardCoverage)
 {
     $commitMsgResponse = new CommitMsgResponse($commitMsg->isEnabled(), $commitMsg->getRegularExpression()->value());
     $prePushResponse = new PrePushResponse($prePush->isEnabled(), $prePush->getMessages()->getRightMessage(), $prePush->getMessages()->getErrorMessage(), new PhpUnitResponse($prePushPhpUnit->isEnabled(), $prePushPhpUnit->getRandomMode()->value(), $prePushPhpUnit->getOptions()->value()), new PhpUnitStrictCoverageResponse($prePushStrictCoverage->isEnabled(), $prePushStrictCoverage->getMinimumStrictCoverage()->value()), new PhpUnitGuardCoverageResponse($prePushGuardCoverage->isEnabled(), $prePushGuardCoverage->getWarningMessage()->value()));
     $preCommitResponse = new PreCommitResponse($preCommit->isEnabled(), $preCommit->getMessages()->getRightMessage()->value(), $preCommit->getMessages()->getErrorMessage()->value(), $composer->isEnabled(), $jsonLint->isEnabled(), $phpLint->isEnabled(), new PhpMdResponse($phpMd->isEnabled(), $phpMd->getOptions()->value()), new PhpCsResponse($phpCs->isEnabled(), $phpCs->getStandard()->value()), new PhpCsFixerResponse($phpCsFixer->isEnabled(), $phpCsFixer->getLevels()->getPsr0()->value(), $phpCsFixer->getLevels()->getPsr1()->value(), $phpCsFixer->getLevels()->getPsr2()->value(), $phpCsFixer->getLevels()->getSymfony()->value()), new PhpUnitResponse($phpUnit->isEnabled(), $phpUnit->getRandomMode()->value(), $phpUnit->getOptions()->value()), new PhpUnitStrictCoverageResponse($phpUnitStrictCoverage->isEnabled(), $phpUnitStrictCoverage->getMinimumStrictCoverage()->value()), new PhpUnitGuardCoverageResponse($phpUnitGuardCoverage->isEnabled(), $phpUnitGuardCoverage->getWarningMessage()->value()));
     return new ConfigurationDataResponse($preCommitResponse, $commitMsgResponse, $prePushResponse);
 }
コード例 #2
0
 /**
  * @param IOInterface $input
  * @param PhpUnitGuardCoverage $phpUnitGuardCoverage
  *
  * @return PhpUnitGuardCoverage
  */
 public function configure(IOInterface $input, PhpUnitGuardCoverage $phpUnitGuardCoverage)
 {
     if (true === $phpUnitGuardCoverage->isUndefined()) {
         $guardCoverageAnswer = $input->ask(HookQuestions::PHPUNIT_GUARD_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER);
         $phpUnitGuardCoverage = $phpUnitGuardCoverage->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($guardCoverageAnswer)));
         if (true === $phpUnitGuardCoverage->isEnabled()) {
             $defaultMessage = $input->ask(HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE, HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE_DEFAULT);
             /** @var PhpUnitGuardCoverage $phpUnitGuardCoverage */
             $phpUnitGuardCoverage = $phpUnitGuardCoverage->setWarningMessage(new Message($defaultMessage));
             $this->coverageGitIgnoreConfigurator->configure();
         }
     }
     return $phpUnitGuardCoverage;
 }