Skip to content

Commit 6977ee9

Browse files
Refacto MetricMapper
1 parent 08aa3dc commit 6977ee9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

app/Presenter/Analyze/Class/Shared/MetricMapper.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@
44

55
use App\Application\Analyze\AnalyzeMetric;
66

7-
/**
8-
* @todo : its work but it's not efficient
9-
*/
107
class MetricMapper
118
{
129
public function from(array $metrics): array
1310
{
14-
$class = [];
15-
16-
foreach ($metrics as $metric) {
17-
$class[] = $this->makeClass($metric);
18-
}
19-
20-
return $class;
11+
return array_map(function (AnalyzeMetric $metric) {
12+
return $this->makeClass($metric);
13+
}, $metrics);
2114
}
2215

2316
private function makeClass(AnalyzeMetric $metric): Metric

0 commit comments

Comments
 (0)