Cancelled
Push — master ( a8b464...2fc3a5 )
by Billie
06:55
created

SeparateSubjectFromBodyWithABlankLineValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 8 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace PurpleBooth\GitGitHubLint\Validator;
6
7
use PurpleBooth\GitGitHubLint\Message;
8
use PurpleBooth\GitGitHubLint\Status\SeparateSubjectFromBodyWithABlankLineStatus;
9
use PurpleBooth\GitGitHubLint\Status\Status;
10
use PurpleBooth\GitGitHubLint\Status\SuccessStatus;
11
12
/**
13
 * This validator will check the subject and the body have a blank line in between te two
14
 *
15
 * @see     SeperateSubjectFromBodyWithABlankLineStatus
16
 * @see     SuccessStatus
17
 *
18
 * @package PurpleBooth\GitGitHubLint\Validator
19
 */
20
class SeparateSubjectFromBodyWithABlankLineValidator implements Validator
21
{
22
    /**
23
     * Check if a message passes a specific test, and return a status that identifies if it is or isn't
24
     *
25
     * @param Message $message
26
     *
27
     * @return Status
28
     */
29
    public function validate(Message $message) : Status
30
    {
31
        if (!$message->hasBlankLineAfterTitle()) {
32
            return new SeparateSubjectFromBodyWithABlankLineStatus();
33
        }
34
35
        return new SuccessStatus();
36
    }
37
}
38