/**
* @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()));
}
}
}
}