validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
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