PhpGitHooks\Module\PhpUnit\Service\GuardCoverageTool::run PHP Method

run() public method

public run ( string $warningMessage )
$warningMessage string
    public function run($warningMessage)
    {
        $outputMessage = new PreCommitOutputWriter(self::CHECKING_MESSAGE);
        $this->output->write($outputMessage->getMessage());
        $this->currentCoverage = $this->strictCoverageProcessor->process();
        $this->previousCoverage = $this->guardReader->read();
        true === $this->isLowerCurrentCoverage() ? $this->output->writeln(sprintf("\n<bg=yellow;options=bold>%s Previous coverage %s, current coverage %s.</>", $warningMessage, $this->previousCoverage, $this->currentCoverage)) : $this->output->writeln($outputMessage->getSuccessfulMessage() . $this->printGuardCoverage());
        $this->guardWriter->write($this->currentCoverage);
    }

Usage Example

 /**
  * @param CommandInterface|GuardCoverageCommand $command
  */
 public function handle(CommandInterface $command)
 {
     $this->guardCoverageTool->run($command->getWarningMessage());
 }