From 793d596541749ca7c088a207789d2835d8326fea Mon Sep 17 00:00:00 2001 From: Yusuf Kandemir Date: Sun, 11 Nov 2018 20:54:31 +0300 Subject: [PATCH] Changed array_map to foreach Unfortunately array_map only accepts arrays. Foreach looks more understandable (and performant) this way. --- src/MicrodataParser.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/MicrodataParser.php b/src/MicrodataParser.php index 983e712..c20ce69 100644 --- a/src/MicrodataParser.php +++ b/src/MicrodataParser.php @@ -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;