DoNotEndTheSubjectLineWithAPeriodValidator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 6 2
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\Validator;
13
14
use PurpleBooth\GitLintValidators\Message;
15
use PurpleBooth\GitLintValidators\Status\DoNotEndTheSubjectLineWithAPeriodStatus;
16
17
/**
18
 * This validator will check if the subject line does not have a full stop at the end.
19
 *
20
 * @see     DoNotEndTheSubjectLineWithAPeriodStatus
21
 */
22
class DoNotEndTheSubjectLineWithAPeriodValidator implements Validator
23
{
24
    /**
25
     * Check if a message passes a specific test, and return a status that identifies if it is or isn't.
26
     *
27
     * @param Message $message
28
     */
29
    public function validate(Message $message)
30
    {
31
        if ($message->hasTitleAFullStop()) {
32
            $message->addStatus(new DoNotEndTheSubjectLineWithAPeriodStatus());
33
        }
34
    }
35
}
36