|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* Copyright (C) 2016 Billie Thompson |
|
7
|
|
|
* |
|
8
|
|
|
* This software may be modified and distributed under the terms |
|
9
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace PurpleBooth\GitLintValidators; |
|
13
|
|
|
|
|
14
|
|
|
use PurpleBooth\GitLintValidators\Validator\CapitalizeTheSubjectLineValidator; |
|
15
|
|
|
use PurpleBooth\GitLintValidators\Validator\DoNotEndTheSubjectLineWithAPeriodValidator; |
|
16
|
|
|
use PurpleBooth\GitLintValidators\Validator\LimitTheBodyWrapLengthTo72CharactersValidator; |
|
17
|
|
|
use PurpleBooth\GitLintValidators\Validator\LimitTheTitleLengthTo69CharactersValidator; |
|
18
|
|
|
use PurpleBooth\GitLintValidators\Validator\SeparateSubjectFromBodyWithABlankLineValidator; |
|
19
|
|
|
use PurpleBooth\GitLintValidators\Validator\SoftLimitTheTitleLengthTo50CharactersValidator; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Build a ready ValidateMessage. |
|
23
|
|
|
*/ |
|
24
|
|
|
class ValidatorFactoryImplementation implements ValidatorFactory |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* Get a message validator set-up with all the validators. |
|
28
|
|
|
* |
|
29
|
|
|
* @return ValidateMessage |
|
30
|
|
|
*/ |
|
31
|
|
|
public function getMessageValidator(): ValidateMessage |
|
32
|
|
|
{ |
|
33
|
|
|
$messageValidator = new ValidateMessageImplementation( |
|
34
|
|
|
[ |
|
35
|
|
|
new CapitalizeTheSubjectLineValidator(), |
|
36
|
|
|
new DoNotEndTheSubjectLineWithAPeriodValidator(), |
|
37
|
|
|
new LimitTheBodyWrapLengthTo72CharactersValidator(), |
|
38
|
|
|
new LimitTheTitleLengthTo69CharactersValidator(), |
|
39
|
|
|
new SeparateSubjectFromBodyWithABlankLineValidator(), |
|
40
|
|
|
new SoftLimitTheTitleLengthTo50CharactersValidator(), |
|
41
|
|
|
] |
|
42
|
|
|
); |
|
43
|
|
|
|
|
44
|
|
|
return $messageValidator; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|