File tree Expand file tree Collapse file tree 7 files changed +20
-17
lines changed
Expand file tree Collapse file tree 7 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 1919final readonly class Analyzer
2020{
2121 public function __construct (
22- private Config $ configDTO ,
23- private CommentTypeFactory $ commentFactory ,
24- private MetricsFacade $ metrics ,
25- private BaselineStorageInterface $ baselineStorage ,
26- private CacheInterface $ cache ,
22+ private Config $ configDTO ,
23+ private CommentTypeFactory $ commentFactory ,
24+ private MetricsFacade $ metrics ,
25+ private BaselineStorageInterface $ baselineStorage ,
26+ private CacheInterface $ cache ,
2727 private CommentStatisticsAggregator $ statisticsAggregator ,
2828 ) {}
2929
Original file line number Diff line number Diff line change 1616final readonly class AnalyzerFactory
1717{
1818 public function getAnalyzer (
19- Config $ configDto ,
19+ Config $ configDto ,
2020 BaselineStorageInterface $ baselineStorage ,
2121 ): Analyzer {
2222 $ commentFactory = new CommentTypeFactory ($ configDto ->getAllowedTypes ());
Original file line number Diff line number Diff line change 2222
2323 public function __construct (
2424 private CommentTypeFactory $ commentFactory ,
25- private Config $ configDTO ,
26- ?Parser $ parser = null ,
25+ private Config $ configDTO ,
26+ ?Parser $ parser = null ,
2727 ) {
2828 $ this ->parser = $ parser ?? (new ParserFactory ())->createForHostVersion ();
2929 }
Original file line number Diff line number Diff line change 1717final readonly class CommentStatisticsAggregator
1818{
1919 public function __construct (
20- private Config $ configDTO ,
20+ private Config $ configDTO ,
2121 private CommentTypeFactory $ commentFactory ,
2222 ) {}
2323
Original file line number Diff line number Diff line change 1111{
1212 public function __construct (
1313 private SplFileInfo $ file ,
14- private Config $ configDTO ,
14+ private Config $ configDTO ,
1515 ) {}
1616
1717 public function getContent (): string
Original file line number Diff line number Diff line change 11<?php
22
3+ declare (strict_types=1 );
4+
35namespace SavinMikhail \CommentsDensity \AnalyzeComments \Formatter \Filter ;
46
57use SavinMikhail \CommentsDensity \AnalyzeComments \Analyzer \DTO \Output \CommentDTO ;
68use SavinMikhail \CommentsDensity \AnalyzeComments \Analyzer \DTO \Output \CommentStatisticsDTO ;
79use SavinMikhail \CommentsDensity \AnalyzeComments \Analyzer \DTO \Output \Report ;
810
11+ use function in_array ;
12+
913final readonly class ViolatingCommentsOnlyFilter
1014{
1115 public function filter (Report $ report ): array
@@ -15,15 +19,14 @@ public function filter(Report $report): array
1519 static fn (CommentStatisticsDTO $ commentStatisticsDTO ): string => $ commentStatisticsDTO ->type ,
1620 array_filter (
1721 $ report ->commentsStatistics ,
18- static fn (CommentStatisticsDTO $ commentStatisticsDTO ): bool => $ commentStatisticsDTO ->color === 'red '
19- )
22+ static fn (CommentStatisticsDTO $ commentStatisticsDTO ): bool => $ commentStatisticsDTO ->color === 'red ' ,
23+ ),
2024 );
2125
2226 return array_filter (
2327 $ report ->comments ,
24- static fn (CommentDTO $ commentDTO ): bool =>
25- in_array ($ commentDTO ->commentType , $ violatingTypes , true )
26- && $ commentDTO ->commentTypeColor === 'red '
28+ static fn (CommentDTO $ commentDTO ): bool => in_array ($ commentDTO ->commentType , $ violatingTypes , true )
29+ && $ commentDTO ->commentTypeColor === 'red ' ,
2730 );
2831 }
29- }
32+ }
Original file line number Diff line number Diff line change 55namespace SavinMikhail \CommentsDensity \AnalyzeComments \Formatter ;
66
77use SavinMikhail \CommentsDensity \AnalyzeComments \Analyzer \DTO \Output \Report ;
8-
98use SavinMikhail \CommentsDensity \AnalyzeComments \Formatter \Filter \ViolatingCommentsOnlyFilter ;
9+
1010use function file_put_contents ;
1111use function htmlspecialchars ;
1212use function nl2br ;
You can’t perform that action at this time.
0 commit comments