PhpGitHooks\Module\PhpMd\Contract\CommandHandler\PhpMdToolCommandHandler::handle PHP Метод

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

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

Usage Example

 /**
  * @test
  */
 public function itShouldWorksFine()
 {
     $phpMdOptions = PhpMdOptionsStub::random();
     $errorMessage = HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT;
     $phpFiles = FilesCommittedStub::createOnlyPhpFiles();
     $outputMessage = new PreCommitOutputWriter(PhpMdTool::CHECKING_MESSAGE);
     $this->shouldWriteOutput($outputMessage->getMessage());
     foreach ($phpFiles as $phpFile) {
         $this->shouldProcessPhpMdTool($phpFile, $phpMdOptions->value(), null);
     }
     $this->shouldWriteLnOutput($outputMessage->getSuccessfulMessage());
     $command = new PhpMdToolCommand($phpFiles, $phpMdOptions->value(), $errorMessage);
     $this->phpMdToolCommandHandler->handle($command);
 }
PhpMdToolCommandHandler