1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of CaptainHook. |
4
|
|
|
* |
5
|
|
|
* (c) Sebastian Feldmann <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
namespace CaptainHook\Hook\Message; |
11
|
|
|
|
12
|
|
|
use CaptainHook\Config; |
13
|
|
|
use CaptainHook\Console\IO; |
14
|
|
|
use CaptainHook\Git\Repository; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Beams |
18
|
|
|
* |
19
|
|
|
* @package CaptainHook |
20
|
|
|
* @author Sebastian Feldmann <[email protected]> |
21
|
|
|
* @link https://github.com/sebastianfeldmann/captainhook |
22
|
|
|
* @since Class available since Release 0.9.0 |
23
|
|
|
*/ |
24
|
|
|
class Beams extends Base |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Execute the configured action. |
28
|
|
|
* |
29
|
|
|
* @param \CaptainHook\Config $config |
30
|
|
|
* @param \CaptainHook\Console\IO $io |
31
|
|
|
* @param \CaptainHook\Git\Repository $repository |
32
|
|
|
* @param \CaptainHook\Config\Action $action |
33
|
|
|
* @throws \CaptainHook\Exception\ActionExecution |
34
|
|
|
*/ |
35
|
3 |
|
public function execute(Config $config, IO $io, Repository $repository, Config\Action $action) |
36
|
|
|
{ |
37
|
3 |
|
$validator = new Validator(); |
38
|
3 |
|
$validator->setRules( |
39
|
|
|
[ |
40
|
3 |
|
new Validator\Rule\CapitalizeSubject(), |
41
|
3 |
|
new Validator\Rule\LimitSubjectLength(50), |
42
|
3 |
|
new Validator\Rule\NoPeriodOnSubjectEnd(), |
43
|
3 |
|
new Validator\Rule\UseImperativeMood(), |
44
|
3 |
|
new Validator\Rule\LimitBodyLineLength(), |
45
|
3 |
|
new Validator\Rule\SeparateSubjectFromBodyWithBlankLine(), |
46
|
|
|
] |
47
|
|
|
); |
48
|
|
|
|
49
|
3 |
|
$this->executeValidator($validator, $repository); |
50
|
2 |
|
} |
51
|
|
|
} |
52
|
|
|
|