Skip to content

Commit 9deb8e3

Browse files
committed
refactor: webhook service
1 parent f9e8a38 commit 9deb8e3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Services/WebhookService.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ protected function eventApproved(string $event): bool
2626
return str_contains($event, 'project');
2727
}
2828

29+
/**
30+
* @param array<string, mixed> $payload
31+
*/
2932
protected function isActionPresent(array $payload): bool
3033
{
3134
return isset($payload['action']);
@@ -48,7 +51,7 @@ protected function hasFieldTemplate(array $payload): bool
4851
return view()->exists('github-project::md.fields.'.$fieldType);
4952
}
5053

51-
protected function createErrorResponse(string $message, ?int $statusCode = 400): JsonResponse
54+
protected function createErrorResponse(string $message, int $statusCode = 400): JsonResponse
5255
{
5356
return response()->json(['message' => __($message)], $statusCode);
5457
}
@@ -88,8 +91,9 @@ public function validatePayload(array $payload): ?JsonResponse
8891
*/
8992
protected function isStatusCommentEnabled(array $payload): bool
9093
{
91-
$fieldName = (string) $payload['changes']['field_value']['field_name'] ?? '';
92-
if ($fieldName === 'Status' && !config('github-project.enable_status_comment')) {
94+
if ((string) $payload['changes']['field_value']['field_name'] === 'Status'
95+
&& !config('github-project.enable_status_comment')
96+
) {
9397
return false;
9498
}
9599

0 commit comments

Comments
 (0)