savinmikhail /
Comments-Density
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO; |
||
| 6 | |||
| 7 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\DocBlockComment; |
||
| 8 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\FixMeComment; |
||
| 9 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\LicenseComment; |
||
| 10 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\MissingDocBlock; |
||
| 11 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\RegularComment; |
||
| 12 | use SavinMikhail\CommentsDensity\AnalyzeComments\Comments\TodoComment; |
||
| 13 | use SavinMikhail\CommentsDensity\Plugin\PluginInterface; |
||
| 14 | |||
| 15 | final readonly class Config |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 16 | { |
||
| 17 | public OutputDTO $output; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param array<string, float> $thresholds |
||
| 21 | * @param PluginInterface[] $plugins |
||
| 22 | 31 | * @param string[] $exclude |
|
| 23 | * @param string[] $directories |
||
| 24 | * @param string[] $disable |
||
| 25 | */ |
||
| 26 | public function __construct( |
||
| 27 | /** Directories to be scanned for comments */ |
||
| 28 | public array $directories, |
||
| 29 | ?OutputDTO $output = null, |
||
| 30 | public MissingDocblockConfigDTO $docblockConfigDTO = new MissingDocblockConfigDTO(), |
||
| 31 | /** Limit occurrences of each comment type */ |
||
| 32 | public array $thresholds = [], |
||
| 33 | /** Directories to be ignored during scanning */ |
||
| 34 | public array $exclude = [], |
||
| 35 | /** Filter collected comments against the baseline stored in baseline.php */ |
||
| 36 | 31 | public bool $useBaseline = true, |
|
| 37 | public string $cacheDir = 'var/cache/comments-density', |
||
| 38 | /** Disable certain types; set to empty array for full statistics */ |
||
| 39 | public array $disable = [], |
||
| 40 | public array $plugins = [], |
||
| 41 | 31 | ) { |
|
| 42 | $this->output = $output ?? ConsoleOutputDTO::create(); |
||
| 43 | 31 | } |
|
| 44 | 31 | ||
| 45 | 31 | /** |
|
| 46 | 31 | * @return non-empty-string[] |
|
| 47 | 31 | */ |
|
| 48 | 31 | public function getAllowedTypes(): array |
|
| 49 | 31 | { |
|
| 50 | 31 | $types = [ |
|
| 51 | DocBlockComment::NAME, |
||
| 52 | 31 | RegularComment::NAME, |
|
| 53 | LicenseComment::NAME, |
||
| 54 | TodoComment::NAME, |
||
| 55 | FixMeComment::NAME, |
||
| 56 | MissingDocBlock::NAME, |
||
| 57 | ]; |
||
| 58 | |||
| 59 | return array_diff($types, $this->disable); |
||
| 60 | } |
||
| 61 | } |
||
| 62 |