1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace AppBuilder\Application\Module\Jira\ValueObject; |
6
|
|
|
|
7
|
|
|
use AppBuilder\Application\Module\Jira\Exception\InvalidJiraStatusException; |
8
|
|
|
|
9
|
|
|
class JiraTicketStatus |
10
|
|
|
{ |
11
|
|
|
public const ABGELEHNT = 'Abgelehnt'; |
12
|
|
|
public const APPROVED = 'Approved'; |
13
|
|
|
public const BACKLOG = 'Backlog'; |
14
|
|
|
public const CANCELLED = 'Cancelled'; |
15
|
|
|
public const CHECK_FINISHED = 'Check finished'; |
16
|
|
|
public const CHECK_IN_PROGRESS = 'Check in progress'; |
17
|
|
|
public const CHECK_WAITING = 'Check waiting'; |
18
|
|
|
public const CLOSED = 'Closed'; |
19
|
|
|
public const DONE = 'Done'; |
20
|
|
|
public const ERLEDIGT = 'Erledigt'; |
21
|
|
|
public const GELOST = 'Gelöst'; |
22
|
|
|
public const IN_PROGRESS = 'In Progress'; |
23
|
|
|
public const IN_REVIEW = 'In Review'; |
24
|
|
|
public const OPEN = 'Open'; |
25
|
|
|
public const REJECTED = 'Rejected'; |
26
|
|
|
public const REOPENED = 'Reopened'; |
27
|
|
|
public const RESOLVED = 'Resolved'; |
28
|
|
|
public const REVIEW_FINISHED = 'Review finished'; |
29
|
|
|
public const REVIEW_IN_PROGRESS = 'Review in progress'; |
30
|
|
|
public const SELECTED_FOR_DEVELOPMENT = 'Selected for development'; |
31
|
|
|
public const TEST_FINISHED = 'Test finished'; |
32
|
|
|
public const TEST_IN_PROGRESS = 'Test in progress'; |
33
|
|
|
public const TO_DO = 'To do'; |
34
|
|
|
public const UNDER_REVIEW = 'Under review'; |
35
|
|
|
public const WAITING = 'Waiting'; |
36
|
|
|
public const WARTET_AUF_ANNAHME = 'wartet auf Annahme'; |
37
|
|
|
public const WARTET_AUF_DEN_SUPPORT = 'Wartet auf den Support'; |
38
|
|
|
public const WARTET_AUF_KUNDEN = 'Wartet auf Kunden'; |
39
|
|
|
public const WARTET_AUF_SUPPORT = 'Wartet auf Support'; |
40
|
|
|
public const WORK_FINISHED = 'Work finished'; |
41
|
|
|
public const WORK_IN_PROGRESS = 'Work in progress'; |
42
|
|
|
|
43
|
|
|
private const ALLOWED_STATUSES = [ |
44
|
|
|
self::ABGELEHNT, |
45
|
|
|
self::APPROVED, |
46
|
|
|
self::BACKLOG, |
47
|
|
|
self::CANCELLED, |
48
|
|
|
self::CHECK_FINISHED, |
49
|
|
|
self::CHECK_IN_PROGRESS, |
50
|
|
|
self::CHECK_WAITING, |
51
|
|
|
self::CLOSED, |
52
|
|
|
self::DONE, |
53
|
|
|
self::ERLEDIGT, |
54
|
|
|
self::GELOST, |
55
|
|
|
self::IN_PROGRESS, |
56
|
|
|
self::IN_REVIEW, |
57
|
|
|
self::OPEN, |
58
|
|
|
self::REJECTED, |
59
|
|
|
self::REOPENED, |
60
|
|
|
self::RESOLVED, |
61
|
|
|
self::REVIEW_FINISHED, |
62
|
|
|
self::REVIEW_IN_PROGRESS, |
63
|
|
|
self::SELECTED_FOR_DEVELOPMENT, |
64
|
|
|
self::TEST_FINISHED, |
65
|
|
|
self::TEST_IN_PROGRESS, |
66
|
|
|
self::TO_DO, |
67
|
|
|
self::UNDER_REVIEW, |
68
|
|
|
self::WAITING, |
69
|
|
|
self::WARTET_AUF_ANNAHME, |
70
|
|
|
self::WARTET_AUF_DEN_SUPPORT, |
71
|
|
|
self::WARTET_AUF_KUNDEN, |
72
|
|
|
self::WARTET_AUF_SUPPORT, |
73
|
|
|
self::WORK_FINISHED, |
74
|
|
|
self::WORK_IN_PROGRESS, |
75
|
|
|
]; |
76
|
|
|
|
77
|
|
|
/** @var string */ |
78
|
|
|
private $status; |
79
|
|
|
|
80
|
2 |
|
public function __construct(string $status) |
81
|
|
|
{ |
82
|
2 |
|
if (!in_array($status, self::ALLOWED_STATUSES, true)) { |
83
|
1 |
|
throw new InvalidJiraStatusException("Status $status not found"); |
84
|
|
|
} |
85
|
1 |
|
$this->status = $status; |
86
|
1 |
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Creates JiraTicketStatus value object with given status. |
90
|
|
|
*/ |
91
|
2 |
|
public static function createFromString(string $status) : self |
92
|
|
|
{ |
93
|
2 |
|
return new self($status); |
94
|
|
|
} |
95
|
|
|
|
96
|
1 |
|
public function status() : string |
97
|
|
|
{ |
98
|
1 |
|
return $this->status; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|