getGroupInfo('ledstarband'); $posts = $this->getWallPosts('ledstarband', 10); foreach($posts as $item) { $post = $this->mapper->map($item); $post->setSourceName($group['name']); if(! $post->isEmpty()) { print_r($post->toArray()); } } } /** @return Generator */ private function getWallPosts(string $id, int $count = 5): Generator { $result = $this->wall->get($id, $count); if (empty ($result['items']) ) { Log::info('Post import failed: no items found'); } # echo "\nFound items: ".$result['count']."\n"; foreach ($result['items'] as $item) { yield $item; } } private function getGroupInfo(string $groupId): ?array { $res = $this->group->getById($groupId); return $res[0] ?? null; } }