Completed
Push — master ( 403335...b6b12e )
by Sebastian
03:08
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
c 1
b 0
f 0
lcom 0
cbo 8
dl 0
loc 28
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 sebastianfeldmann\CaptainHook\Hook\Message\Check;
11
12
use sebastianfeldmann\CaptainHook\Config;
13
use sebastianfeldmann\CaptainHook\Console\IO;
14
use sebastianfeldmann\CaptainHook\Git\Repository;
15
use sebastianfeldmann\CaptainHook\Hook\Message\Rule;
16
use sebastianfeldmann\CaptainHook\Hook\Message\RuleBook;
17
18
/**
19
 * Class Beams
20
 *
21
 * @package CaptainHook
22
 * @author  Sebastian Feldmann <[email protected]>
23
 * @link    https://github.com/sebastianfeldmann/captainhook
24
 * @since   Class available since Release 0.9.0
25
 */
26
class Beams extends Book
27
{
28
    /**
29
     * Execute the configured action.
30
     *
31
     * @param  \sebastianfeldmann\CaptainHook\Config         $config
32
     * @param  \sebastianfeldmann\CaptainHook\Console\IO     $io
33
     * @param  \sebastianfeldmann\CaptainHook\Git\Repository $repository
34
     * @param  \sebastianfeldmann\CaptainHook\Config\Action  $action
35
     * @throws \sebastianfeldmann\CaptainHook\Exception\ActionExecution
36
     */
37 2
    public function execute(Config $config, IO $io, Repository $repository, Config\Action $action)
38
    {
39 2
        $book = new RuleBook();
40 2
        $book->setRules(
41
            [
42 2
                new Rule\CapitalizeSubject(),
43 2
                new Rule\LimitSubjectLength(50),
44 2
                new Rule\NoPeriodOnSubjectEnd(),
45 2
                new Rule\UseImperativeMood(),
46 2
                new Rule\LimitBodyLineLength(),
47 2
                new Rule\SeparateSubjectFromBodyWithBlankLine(),
48
            ]
49
        );
50
51 2
        $this->validate($book, $repository);
52 1
    }
53
}
54