@@ -31,7 +31,8 @@ public function __construct(
3131 protected Factory $ output ,
3232 protected Client $ github ,
3333 protected ResultPager $ paginator ,
34- ) {}
34+ ) {
35+ }
3536
3637 public function repositories (array $ repositories ): self
3738 {
@@ -75,16 +76,15 @@ public function markAll(): void
7576
7677 public function mark (): void
7778 {
78- if (! $ items = $ this ->paginated ()) {
79+ if (!$ items = $ this ->paginated ()) {
7980 Output::success ('No unread notifications ' );
8081
8182 return ;
8283 }
8384
8485 $ count = count ($ items );
8586
86- Output::info ('unread notifications detected ' , $ count );
87-
87+ $ this ->detected ($ count );
8888 $ this ->process ($ items );
8989 $ this ->result ($ count );
9090 }
@@ -122,9 +122,9 @@ protected function notifications(): Notification
122122 protected function requestByType (NotificationData $ notification ): ?array
123123 {
124124 return match ($ notification ->type ) {
125- 'Issue ' => $ this ->issue ($ notification ),
125+ 'Issue ' => $ this ->issue ($ notification ),
126126 'PullRequest ' => $ this ->pullRequest ($ notification ),
127- default => null
127+ default => null
128128 };
129129 }
130130
@@ -148,7 +148,7 @@ protected function pullRequest(NotificationData $notification): array
148148
149149 protected function shouldSkip (NotificationData $ notification , ItemData $ item ): bool
150150 {
151- if ($ this ->repositories && ! Str::startsWith ($ notification ->fullName , $ this ->repositories )) {
151+ if ($ this ->repositories && !Str::startsWith ($ notification ->fullName , $ this ->repositories )) {
152152 return true ;
153153 }
154154
@@ -173,12 +173,22 @@ protected function shouldSkip(NotificationData $notification, ItemData $item): b
173173
174174 protected function result (int $ count ): void
175175 {
176+ $ pluralized = $ this ->marked === 1 ? 'notification ' : 'notifications ' ;
177+
176178 $ info = sprintf (
177- '%d notifications were marked as read and %d were skipped. ' ,
179+ '%d %s were marked as read and %d were skipped. ' ,
178180 $ this ->marked ,
181+ $ pluralized ,
179182 $ count - $ this ->marked
180183 );
181184
182185 $ this ->marked ? Output::success ($ info ) : Output::info ($ info );
183186 }
187+
188+ protected function detected (int $ count ): void
189+ {
190+ $ pluralized = $ this ->marked === 1 ? 'notification ' : 'notifications ' ;
191+
192+ Output::info ("unread $ pluralized detected " , $ count );
193+ }
184194}
0 commit comments