Skip to content

Commit

Permalink
refactor file finder
Browse files Browse the repository at this point in the history
  • Loading branch information
savinmikhail committed Jan 4, 2025
1 parent f31de9d commit 73a1db6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/AnalyzeComments/Analyzer/Analyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ public function analyze(): Report
$comments = [];
$filesAnalyzed = 0;
$totalLinesOfCode = 0;
foreach ((new FileFinder($this->configDTO))() as $file) {
$fileFinder = new FileFinder($this->configDTO);
foreach ($fileFinder() as $file) {
$commentFinder = new CommentFinder(
$this->commentFactory,
$this->configDTO,
);
$contentExtractor = new FileContentExtractor($file, $this->configDTO);
$contentExtractor = new FileContentExtractor($file);

$fileComments = $this->cache->get(
$this->getCacheKey($file),
Expand Down
2 changes: 0 additions & 2 deletions src/AnalyzeComments/File/FileContentExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

namespace SavinMikhail\CommentsDensity\AnalyzeComments\File;

use SavinMikhail\CommentsDensity\AnalyzeComments\Config\DTO\Config;
use SplFileInfo;

final readonly class FileContentExtractor
{
public function __construct(
private SplFileInfo $file,
private Config $configDTO,
) {}

public function getContent(): string
Expand Down

0 comments on commit 73a1db6

Please sign in to comment.