Completed
Push — master ( 68efd7...e19da4 )
by Billie
09:36
created

validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
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\SeperateSubjectFromBodyWithABlankLineStatus;
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 SeperateSubjectFromBodyWithABlankLineValidator 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 SeperateSubjectFromBodyWithABlankLineStatus();
33
        }
34
35
        return new SuccessStatus();
36
    }
37
}
38