NoPeriodOnSubjectEnd::pass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Hook\Message\Rule;
13
14
use SebastianFeldmann\Git\CommitMessage;
15
16
/**
17
 * Class NoPeriodOnSubjectEnd
18
 *
19
 * @package CaptainHook
20
 * @author  Sebastian Feldmann <[email protected]>
21
 * @link    https://github.com/captainhook-git/captainhook
22
 * @since   Class available since Release 0.9.0
23
 */
24
class NoPeriodOnSubjectEnd extends Base
25
{
26
    /**
27
     * Constructor
28
     */
29 6
    public function __construct()
30
    {
31 6
        $this->hint = 'Subject should not end with a period';
32
    }
33
34
    /**
35
     * Check if commit message doesn't end with a period
36
     *
37
     * @param  \SebastianFeldmann\Git\CommitMessage $msg
38
     * @return bool
39
     */
40 6
    public function pass(CommitMessage $msg): bool
41
    {
42 6
        return substr(trim($msg->getSubject()), -1) !== '.';
43
    }
44
}
45