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 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 PreCommitResponse $preCommitResponse * @param array $committedFiles */ private function executeTools(PreCommitResponse $preCommitResponse, array $committedFiles) { if (true === $preCommitResponse->isComposer()) { $this->commandBus->handle(new ComposerToolCommand($committedFiles, $preCommitResponse->getErrorMessage())); } if (true === $preCommitResponse->isJsonLint()) { $this->commandBus->handle(new JsonLintToolCommand($committedFiles, $preCommitResponse->getErrorMessage())); } $phpFiles = $this->getPhpFiles($committedFiles); if ($phpFiles) { if (true === $preCommitResponse->isPhpLint()) { $this->commandBus->handle(new PhpLintToolCommand($phpFiles, $preCommitResponse->getErrorMessage())); } $phpCsResponse = $preCommitResponse->getPhpCs(); if (true === $phpCsResponse->isPhpCs()) { $this->commandBus->handle(new PhpCsToolCommand($phpFiles, $phpCsResponse->getPhpCsStandard(), $preCommitResponse->getErrorMessage())); } $phpCsFixerResponse = $preCommitResponse->getPhpCsFixer(); if (true === $phpCsFixerResponse->isPhpCsFixer()) { $this->commandBus->handle(new PhpCsFixerToolCommand($phpFiles, $phpCsFixerResponse->isPhpCsFixerPsr0(), $phpCsFixerResponse->isPhpCsFixerPsr1(), $phpCsFixerResponse->isPhpCsFixerPsr2(), $phpCsFixerResponse->isPhpCsFixerSymfony(), $phpCsFixerResponse->getPhpCsFixerOptions(), $preCommitResponse->getErrorMessage())); } $phpMdResponse = $preCommitResponse->getPhpMd(); if (true === $phpMdResponse->isPhpMd()) { $this->commandBus->handle(new PhpMdToolCommand($phpFiles, $phpMdResponse->getPhpMdOptions(), $preCommitResponse->getErrorMessage())); } $phpunitResponse = $preCommitResponse->getPhpUnit(); if (true === $phpunitResponse->isPhpunit()) { $this->commandBus->handle(new PhpUnitToolCommand($phpunitResponse->isPhpunitRandomMode(), $phpunitResponse->getPhpunitOptions(), $preCommitResponse->getErrorMessage())); $phpunitStrictCoverageResponse = $preCommitResponse->getPhpUnitStrictCoverage(); if (true === $phpunitStrictCoverageResponse->isPhpunitStrictCoverage()) { $this->commandBus->handle(new StrictCoverageCommand($phpunitStrictCoverageResponse->getMinimum(), $preCommitResponse->getErrorMessage())); } $phpunitGuardCoverageResponse = $preCommitResponse->getPhpUnitGuardCoverage(); if (true === $phpunitGuardCoverageResponse->isEnabled()) { $this->commandBus->handle(new GuardCoverageCommand($phpunitGuardCoverageResponse->getWarningMessage())); } } } }