/**
  * @param array  $files
  * @param string $errorMessage
  */
 public function execute(array $files, $errorMessage)
 {
     $jsonFilesResponse = $this->queryBus->handle(new JsonFilesExtractorQuery($files));
     if (true === $this->jsonFilesExists($jsonFilesResponse->getFiles())) {
         $this->jsonLintToolExecutor->execute($jsonFilesResponse->getFiles(), $errorMessage);
     }
 }
 public function configure()
 {
     /** @var GitIgnoreDataResponse $gitIgnoreContent */
     $gitIgnoreContent = $this->queryBus->handle(new GitIgnoreExtractorQuery());
     if (false === $this->isFileIgnored($gitIgnoreContent->getContent())) {
         $content = $this->getContent($gitIgnoreContent->getContent());
         $this->commandBus->handle(new GitIgnoreWriterCommand($content));
     }
 }
 /**
  * @param InputInterface $input
  *
  * @throws InvalidCommitMessageException
  */
 public function run(InputInterface $input)
 {
     /** @var ConfigurationDataResponse $configurationDataResponse */
     $configurationDataResponse = $this->queryBus->handle(new ConfigurationDataFinderQuery());
     if (true === $configurationDataResponse->getCommitMsg()->isCommitMsg()) {
         $commitContent = $this->commitMessageFinder->find($input->getFirstArgument());
         $validMessage = $this->isValidCommitMessage($configurationDataResponse->getCommitMsg()->getRegularExpression(), $commitContent);
         if (false === $validMessage) {
             throw new InvalidCommitMessageException();
         }
     }
 }
Beispiel #4
0
 /**
  * @param string $remote
  * @param string $url
  *
  * @throws InvalidPushException
  */
 public function execute($remote, $url)
 {
     /** @var ConfigurationDataResponse $configurationData */
     $configurationData = $this->queryBus->handle(new ConfigurationDataFinderQuery());
     $prePushResponse = $configurationData->getPrePush();
     if (true === $prePushResponse->isPrePush()) {
         $this->output->writeln(self::PRE_PUSH_HOOK);
         $this->executeOriginalHook($remote, $url, $prePushResponse->getErrorMessage());
         $phpunitResponse = $prePushResponse->getPhpUnit();
         if (true === $phpunitResponse->isPhpunit()) {
             $this->commandBus->handle(new PhpUnitToolCommand($phpunitResponse->isPhpunitRandomMode(), $phpunitResponse->getPhpunitOptions(), $prePushResponse->getErrorMessage()));
             $phpunitStrictCoverageResponse = $prePushResponse->getPhpUnitStrictCoverage();
             if (true === $phpunitStrictCoverageResponse->isPhpunitStrictCoverage()) {
                 $this->commandBus->handle(new StrictCoverageCommand($phpunitStrictCoverageResponse->getMinimum(), $prePushResponse->getErrorMessage()));
             }
             $phpunitGuardCoverageResponse = $prePushResponse->getPhpUnitGuardCoverage();
             if (true === $phpunitGuardCoverageResponse->isEnabled()) {
                 $this->commandBus->handle(new GuardCoverageCommand($phpunitGuardCoverageResponse->getWarningMessage()));
             }
         }
         $this->output->writeln(GoodJobLogoResponse::paint($prePushResponse->getRightMessage()));
     }
 }
 /**
  * @param array $committedFiles
  *
  * @return array
  */
 private function getPhpFiles(array $committedFiles)
 {
     /** @var PhpFilesResponse $phpFilesResponse */
     $phpFilesResponse = $this->queryBus->handle(new PhpFilesExtractorQuery($committedFiles));
     return $phpFilesResponse->getFiles();
 }
 /**
  * @param array $files
  *
  * @return ComposerFilesResponse
  */
 private function getComposerFilesResponse(array $files)
 {
     return $this->queryBus->handle(new ComposerFilesExtractorQuery($files));
 }