Skip to content

Commit 8061272

Browse files
Merge pull request #72 from TheDragonCode/1.x
Improved display of messages indicating singular numbers
2 parents 44a0d93 + 37ebc2f commit 8061272

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/Services/GitHub.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ public function mark(): void
8383

8484
$count = count($items);
8585

86-
Output::info('unread notifications detected', $count);
87-
86+
$this->detected($count);
8887
$this->process($items);
8988
$this->result($count);
9089
}
@@ -173,12 +172,22 @@ protected function shouldSkip(NotificationData $notification, ItemData $item): b
173172

174173
protected function result(int $count): void
175174
{
175+
$pluralized = $this->marked === 1 ? 'notification' : 'notifications';
176+
176177
$info = sprintf(
177-
'%d notifications were marked as read and %d were skipped.',
178+
'%d %s were marked as read and %d were skipped.',
178179
$this->marked,
180+
$pluralized,
179181
$count - $this->marked
180182
);
181183

182184
$this->marked ? Output::success($info) : Output::info($info);
183185
}
186+
187+
protected function detected(int $count): void
188+
{
189+
$pluralized = $this->marked === 1 ? 'notification' : 'notifications';
190+
191+
Output::info("unread $pluralized detected", $count);
192+
}
184193
}

0 commit comments

Comments
 (0)