Skip to content

Commit

Permalink
Refacto MetricMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
DeGraciaMathieu committed Nov 14, 2024
1 parent 08aa3dc commit 6977ee9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions app/Presenter/Analyze/Class/Shared/MetricMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@

use App\Application\Analyze\AnalyzeMetric;

/**
* @todo : its work but it's not efficient
*/
class MetricMapper
{
public function from(array $metrics): array
{
$class = [];

foreach ($metrics as $metric) {
$class[] = $this->makeClass($metric);
}

return $class;
return array_map(function (AnalyzeMetric $metric) {
return $this->makeClass($metric);
}, $metrics);
}

private function makeClass(AnalyzeMetric $metric): Metric
Expand Down

0 comments on commit 6977ee9

Please sign in to comment.