@@ -78,19 +78,15 @@ public function mark(): void
7878 foreach ($ items as $ data ) {
7979 $ notification = new NotificationData ($ data );
8080
81- $ data = $ notification ->type === 'Issue '
82- ? $ this ->issue ($ notification )
83- : $ this ->pullRequest ($ notification );
84-
85- $ item = new ItemData ($ data );
81+ $ item = new ItemData ($ this ->requestByType ($ notification ));
8682
8783 $ this ->shouldSkip ($ notification , $ item )
8884 ? $ this ->output ->twoColumnDetail ($ notification ->fullName , 'SKIP ' )
8985 : $ this ->output ->task ($ notification ->fullName , fn () => $ this ->markAsRead ($ notification ));
9086 }
9187 }
9288
93- protected function markAsRead (NotificationData $ data ): bool
89+ protected function markAsRead (NotificationData $ data ): void
9490 {
9591 $ this ->github ->notification ()->markThreadRead ($ data ->id );
9692 }
@@ -105,6 +101,15 @@ protected function notifications(): Notification
105101 return $ this ->github ->notifications ();
106102 }
107103
104+ protected function requestByType (NotificationData $ notification ): ?array
105+ {
106+ return match ($ notification ->type ) {
107+ 'Issue ' => $ this ->issue ($ notification ),
108+ 'PullRequest ' => $ this ->pullRequest ($ notification ),
109+ default => null
110+ };
111+ }
112+
108113 protected function issue (NotificationData $ notification ): array
109114 {
110115 return $ this ->github ->issues ()->show (
@@ -141,6 +146,6 @@ protected function shouldSkip(NotificationData $notification, ItemData $item): b
141146 return true ;
142147 }
143148
144- return ( bool ) ( $ item ->isOpen || ! $ item ->isMerged ) ;
149+ return $ item ->isOpen || ! $ item ->isMerged ;
145150 }
146151}
0 commit comments