forked from symfony-tools/carsonbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaleIssueCommentGenerator.php
More file actions
84 lines (73 loc) · 2.33 KB
/
StaleIssueCommentGenerator.php
File metadata and controls
84 lines (73 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
declare(strict_types=1);
namespace App\Service;
use App\Api\Issue\IssueType;
/**
* @author Tobias Nyholm <[email protected]>
*/
class StaleIssueCommentGenerator
{
/**
* Get a comment to say: "I will close this soon".
*/
public function getInformAboutClosingComment(): string
{
$messages = [
'Hello? This issue is about to be closed if nobody replies.',
'Friendly ping? Should this still be open? I will close if I don\'t hear anything.',
'Could I get a reply or should I close this?',
'Just a quick reminder to make a comment on this. If I don\'t hear anything I\'ll close this.',
'Friendly reminder that this issue exists. If I don\'t hear anything I\'ll close this.',
'Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3',
];
return $messages[array_rand($messages)];
}
/**
* Get a comment to say: "I'm closing this now".
*/
public function getClosingComment(): string
{
return <<<TXT
Hey,
I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!
TXT;
}
/**
* Get a comment that encourage users to reply or close the issue themselves.
*
* @param string $type Valid types are IssueType::*
*/
public function getComment(string $type): string
{
switch ($type) {
case IssueType::BUG:
return $this->bug();
case IssueType::FEATURE:
case IssueType::RFC:
return $this->feature();
default:
return $this->unknown();
}
}
private function bug(): string
{
return <<<TXT
Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?
TXT;
}
private function feature(): string
{
return <<<TXT
Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?
TXT;
}
private function unknown(): string
{
return <<<TXT
Thank you for this issue.
There has not been a lot of activity here for a while. Has this been resolved?
TXT;
}
}