Passed
Push — master ( b649b5...b34030 )
by Sebastian
04:07
created

Beams   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 28
c 1
b 0
f 0
ccs 11
cts 11
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 16 1
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