PhpGitHooks\Module\Git\Service\PrePushTool::execute PHP Метод

execute() публичный Метод

public execute ( string $remote, string $url )
$remote string
$url string
    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()));
        }
    }

Usage Example

 /**
  * @param CommandInterface|PrePushToolCommand $command
  */
 public function handle(CommandInterface $command)
 {
     $this->prePushTool->execute($command->getRemote(), $command->getUrl());
 }