Skip to content

Commit

Permalink
Adds minor code optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelstolt committed May 14, 2024
1 parent 0c7e9ac commit d365d1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 1 addition & 5 deletions app/Domain/PackageAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

class PackageAnalyser
{
private string $directoryToAnalyse;

private array $steps;

private array $stepIds;
Expand All @@ -23,10 +21,8 @@ class PackageAnalyser
/**
* @throws NonExistentPackageDirectory
*/
public function __construct(string $directoryToAnalyse)
public function __construct(readonly string $directoryToAnalyse)
{
$this->directoryToAnalyse = $directoryToAnalyse;

if (! file_exists($directoryToAnalyse)) {
$exceptionMessage = sprintf("Provided package directory '%s' does not exist.", $directoryToAnalyse);
throw new NonExistentPackageDirectory($exceptionMessage);
Expand Down
5 changes: 1 addition & 4 deletions app/Domain/ReportWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ class ReportWriter

private string $directoryAnalysed;

private string $outputDirectory;

public function __construct(PackageAnalyser $analyser, string $outputDirectory)
public function __construct(PackageAnalyser $analyser, readonly string $outputDirectory)
{
$this->analyseSteps = $analyser->getSteps();
$this->directoryAnalysed = $analyser->getDirectoryToAnalyse();
$this->outputDirectory = $outputDirectory;
}

public function write(): bool
Expand Down

0 comments on commit d365d1e

Please sign in to comment.