Changed array_map to foreach

Unfortunately array_map only accepts arrays. Foreach looks more understandable (and performant) this way.
This commit is contained in:
Yusuf Kandemir 2018-11-11 20:54:31 +03:00
parent 0e2f17ac37
commit 793d596541
1 changed files with 3 additions and 6 deletions

View File

@ -23,12 +23,9 @@ class MicrodataParser
$items = [];
// Step 3
// items = map("top-level microdata items", item => getObject(item))
$items = array_map([$this, 'getObject'], iterator_to_array($this->topLevelItems));
/*foreach ($topLevelItems as $topLevelItem) {
$items[] = getObject($topLevelItem);
}*/
foreach ($this->topLevelItems as $topLevelItem) {
$items[] = $this->getObject($topLevelItem);
}
// Step 4
$result->items = $items;