array_map(function ($item) { if ($item instanceof NewsItem) { return $item->toJsonArray(); } }, $this->get('items'))]; } /** * @return array * @author 等风来 * @email 136327134@qq.com * @date 2023/9/26 */ public function toXmlArray(): array { $items = []; foreach ($this->get('items') as $item) { if ($item instanceof NewsItem) { $items[] = $item->toXmlArray(); } } return [ 'ArticleCount' => count($items), 'Articles' => $items, ]; } }