File tree Expand file tree Collapse file tree 1 file changed +11
-23
lines changed
Expand file tree Collapse file tree 1 file changed +11
-23
lines changed Original file line number Diff line number Diff line change @@ -21,24 +21,19 @@ public function __construct(IssueMessage $issue)
2121 */
2222 public function toString ()
2323 {
24- $ msgs = [];
2524 $ msg = trim ($ this ->issue ->getMessage ());
2625 if (count ($ this ->issue ->getIssues ()))
2726 {
28- $ msgs = [$ msg . ': ' ];
29- foreach ($ this ->issue ->getIssues () as $ issue )
30- {
31- $ issues = static ::getSubIssues ($ issue );
32- if ($ issues )
33- {
34- array_push ($ msgs , ...$ issues );
35- }
36- }
27+ $ msg .= ': ' ;
3728 }
38- else
29+
30+ $ msgs = [$ msg ];
31+ $ issues = static ::getSubIssues ($ this ->issue );
32+ if ($ issues )
3933 {
40- $ msgs = [ $ msg ] ;
34+ array_push ( $ msgs, ... $ issues ) ;
4135 }
36+
4237 return implode ("\n" , $ msgs );
4338 }
4439
@@ -53,18 +48,11 @@ protected static function getSubIssues(IssueMessage $issue, $level = 0)
5348 foreach ($ issue ->getIssues () as $ sub_issue )
5449 {
5550 $ msg = str_repeat (' ' , $ level ) . '- ' . trim ($ sub_issue ->getMessage ());
56- if (count ($ sub_issue ->getIssues ()))
57- {
58- $ msgs [] = $ msg ;
59- $ issues = static ::getSubIssues ($ sub_issue , $ level + 1 );
60- if ($ issues )
61- {
62- array_push ($ msgs , ...$ issues );
63- }
64- }
65- else
51+ $ msgs [] = $ msg ;
52+ $ issues = static ::getSubIssues ($ sub_issue , $ level + 1 );
53+ if ($ issues )
6654 {
67- $ msgs[] = $ msg ;
55+ array_push ( $ msgs, ... $ issues ) ;
6856 }
6957 }
7058 return $ msgs ;
You can’t perform that action at this time.
0 commit comments