55use App \Model \Repository ;
66use Github \Api \Issue \Labels ;
77use Github \Exception \RuntimeException ;
8+ use Psr \Log \LoggerInterface ;
89use Symfony \Contracts \Cache \CacheInterface ;
910use Symfony \Contracts \Cache \ItemInterface ;
1011
@@ -30,10 +31,16 @@ class GithubLabelApi implements LabelApi
3031 */
3132 private $ cache ;
3233
33- public function __construct (Labels $ labelsApi , CacheInterface $ cache )
34+ /**
35+ * @var LoggerInterface
36+ */
37+ private $ logger ;
38+
39+ public function __construct (Labels $ labelsApi , CacheInterface $ cache , LoggerInterface $ logger )
3440 {
3541 $ this ->labelsApi = $ labelsApi ;
3642 $ this ->cache = $ cache ;
43+ $ this ->logger = $ logger ;
3744 }
3845
3946 public function getIssueLabels ($ issueNumber , Repository $ repository ): array
@@ -54,7 +61,10 @@ public function getIssueLabels($issueNumber, Repository $repository): array
5461 }
5562 }
5663
57- return array_keys ($ this ->labelCache [$ key ]);
64+ $ labels = array_keys ($ this ->labelCache [$ key ]);
65+ $ this ->logger ->debug ('Returning labels for {repo}#{issue} ' , ['repo ' => $ repository ->getFullName (), 'issue ' => $ issueNumber ]);
66+
67+ return $ labels ;
5868 }
5969
6070 public function addIssueLabel ($ issueNumber , string $ label , Repository $ repository )
@@ -65,12 +75,8 @@ public function addIssueLabel($issueNumber, string $label, Repository $repositor
6575 return ;
6676 }
6777
68- $ this ->labelsApi ->add (
69- $ repository ->getVendor (),
70- $ repository ->getName (),
71- $ issueNumber ,
72- $ label
73- );
78+ $ this ->logger ->debug ('Adding label "{label}" for {repo}#{issue} ' , ['label ' => $ label , 'repo ' => $ repository ->getFullName (), 'issue ' => $ issueNumber ]);
79+ $ this ->labelsApi ->add ($ repository ->getVendor (), $ repository ->getName (), $ issueNumber , $ label );
7480
7581 // Update cache if already loaded
7682 if (isset ($ this ->labelCache [$ key ])) {
0 commit comments