PhpGitHooks\Module\JsonLint\Contract\CommandHandler\JsonLintToolCommandHandler::handle PHP Метод

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

public handle ( Bruli\EventBusBundle\CommandBus\CommandInterface $command )
$command Bruli\EventBusBundle\CommandBus\CommandInterface
    public function handle(CommandInterface $command)
    {
        $this->jsonLintTool->execute($command->getFiles(), $command->getErrorMessage());
    }

Usage Example

 /**
  * @test
  */
 public function itShouldThrowsException()
 {
     $this->expectException(JsonLintViolationsException::class);
     $output = new PreCommitOutputWriter(JsonLintToolExecutor::CHECKING_MESSAGE);
     $jsonFilesResponse = JsonFilesResponseStub::createWithJsonData();
     $this->shouldHandleQuery(new JsonFilesExtractorQuery($jsonFilesResponse->getFiles()), $jsonFilesResponse);
     $this->shouldWriteOutput($output->getMessage());
     $errorTxt = null;
     foreach ($jsonFilesResponse->getFiles() as $file) {
         $error = 'ERROR';
         $this->shouldProcessJsonLint($file, $error);
         $errorTxt .= $error;
     }
     $this->shouldWriteLnOutput($output->getFailMessage());
     $this->shouldWriteLnOutput($output->setError($errorTxt));
     $this->shouldWriteLnOutput(BadJobLogoResponse::paint($this->errorMessage));
     $this->jsonLintToolCommandHandler->handle(new JsonLintToolCommand($jsonFilesResponse->getFiles(), $this->errorMessage));
 }
JsonLintToolCommandHandler