PHP code example of purplebooth / git-lint-validators

1. Go to this page and download the library: Download purplebooth/git-lint-validators library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

purplebooth / git-lint-validators example snippets




$validatorFactory = new ValidatorFactoryImplementation();
$validators       = $validatorFactory->getMessageValidator();

$message
    = <<<MESSAGE
This is an example title

This is a message body. This is another part of the body.
MESSAGE;

$exampleMessage = new MessageImplementation("exampleSha", $message);

$validators->validate($exampleMessage);
// -> Message Object will now have a Status objects set on them



new ValidateMessageImplementation(
    [
        new CapitalizeTheSubjectLineValidator(),
        new DoNotEndTheSubjectLineWithAPeriodValidator(),
    ]
);

$message
    = <<<MESSAGE
This is an example title

This is a message body. This is another part of the body.
MESSAGE;

$exampleMessage = new MessageImplementation("exampleSha", $message);

$messageValidator->validate($exampleMessage);
// -> Message Object will now have a Status objects set on them