1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace PurpleBooth\GitGitHubLint\Status; |
6
|
|
|
|
7
|
|
|
use PurpleBooth\GitGitHubLint\Validator\SeparateSubjectFromBodyWithABlankLineValidator; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This is the status returned when the SeperateSubjectFromBodyWithABlankLineValidator identifies a problem |
11
|
|
|
* |
12
|
|
|
* @see SeparateSubjectFromBodyWithABlankLineValidator |
13
|
|
|
* |
14
|
|
|
* @package PurpleBooth\GitGitHubLint\Status |
15
|
|
|
*/ |
16
|
|
|
class SeparateSubjectFromBodyWithABlankLineStatus implements Status |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* Get the importance of this status. |
20
|
|
|
* |
21
|
|
|
* The lower the value the less important it is, the higher the more important. |
22
|
|
|
* |
23
|
|
|
* @return int |
24
|
|
|
*/ |
25
|
|
|
public function getWeight() : int |
26
|
|
|
{ |
27
|
|
|
return Status::WEIGHT_ERROR; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The GitHub equivalent of this state |
32
|
|
|
* |
33
|
|
|
* Can be one of pending, success, error, or failure. |
34
|
|
|
* |
35
|
|
|
* @return string |
36
|
|
|
*/ |
37
|
|
|
public function getState() : string |
38
|
|
|
{ |
39
|
|
|
return Status::STATE_FAILURE; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* A human readable message that describes this state |
44
|
|
|
* |
45
|
|
|
* This will be displayed to the user via the GitHub state |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public function getMessage() : string |
50
|
|
|
{ |
51
|
|
|
return 'Please put a single blank line between the subject and body of the commit message'; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Is true if the status on GitHub would be success |
56
|
|
|
* |
57
|
|
|
* @return boolean |
58
|
|
|
*/ |
59
|
|
|
public function isPositive() : bool |
60
|
|
|
{ |
61
|
|
|
return $this->getState() == Status::STATE_SUCCESS; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get a URL with further explanation about this commit message status |
66
|
|
|
* |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
public function getDetailsUrl() : string |
70
|
|
|
{ |
71
|
|
|
return "http://chris.beams.io/posts/git-commit/#separate"; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|