Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Add formatting support #201

Merged
merged 19 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Style: Made some style changes
  • Loading branch information
olivernybroe committed Jul 8, 2019
commit 2c0a1af03d6afb907d5871ebd3de054490839a4a
6 changes: 3 additions & 3 deletions src/Application/Console/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ public function __construct(InsightCollectionFactory $insightCollectionFactory)
/**
* Analyse the given dirs.
*
* @param Formatter $format
* @param Formatter $formatter
* @param array<string, array> $config
olivernybroe marked this conversation as resolved.
Show resolved Hide resolved
* @param string $dir
* @param OutputInterface $consoleOutput
*
* @return \NunoMaduro\PhpInsights\Domain\Results
*/
public function analyse(
Formatter $format,
Formatter $formatter,
array $config,
string $dir,
OutputInterface $consoleOutput
Expand All @@ -52,7 +52,7 @@ public function analyse(
$insightCollection = $this->insightCollectionFactory
->get($metrics, $config, $dir, $consoleOutput);

$format->format($insightCollection, $dir, $metrics);
$formatter->format($insightCollection, $dir, $metrics);

return $insightCollection->results();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/Console/Commands/AnalyseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __invoke(InputInterface $input, OutputInterface $output): int

$output = OutputDecorator::decorate($output);

$format = FormatResolver::resolve($input, $output, $consoleOutput);
$formatter = FormatResolver::resolve($input, $output, $consoleOutput);

$directory = $this->getDirectory($input);

Expand All @@ -82,7 +82,7 @@ public function __invoke(InputInterface $input, OutputInterface $output): int
$config = $this->excludeGlobalInsights($config);
}
$results = $this->analyser->analyse(
$format,
$formatter,
$config,
$directory,
$consoleOutput
Expand Down
4 changes: 2 additions & 2 deletions src/Application/Console/Contracts/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ interface Formatter
/**
* Format the result to the desired format.
*
* @param InsightCollection $insightCollection
* @param \NunoMaduro\PhpInsights\Domain\Insights\InsightCollection $insightCollection
* @param string $dir
* @param array<string> $metrics
* @param array<int, string> $metrics
*/
public function format(
InsightCollection $insightCollection,
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Contracts/HasDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface HasDetails extends Insight
/**
* Returns the details of the insight.
*
* @return array<\NunoMaduro\PhpInsights\Domain\Details>
* @return array<int, \NunoMaduro\PhpInsights\Domain\Details>
*/
public function getDetails(): array;
}
2 changes: 1 addition & 1 deletion src/Domain/Details.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class Details

public static function make(): Details
{
return new Details();
return new self();
}

public function withFile(string $file): Details
olivernybroe marked this conversation as resolved.
Show resolved Hide resolved
Expand Down