static function getItems(Feed &$feed) { $fid = $feed->getId(); $text = $feed->getMessage(); static::doParse($text); $assocs = static::$array; $result = array(); foreach ($assocs as $index => $assoc) { $item = new Item(); $item->setId($fid . '_' . $index); $item->setFeed($feed); if (isset($assoc['type'])) { $item->setType($assoc['type']); } else { $item->setType('GLOBAL'); } if (isset($assoc['description'])) { $item->setDescription($assoc['description']); } if (isset($assoc['global'])) { $item->setGlobal($assoc['global']); } if (isset($assoc['name'])) { $item->setName($assoc['name']); } if (isset($assoc['note'])) { $item->setNote($assoc['note']); } if (isset($assoc['price_digit'])) { $item->setPrice($assoc['price_digit']); } if (isset($assoc['price'])) { $item->setPriceStr($assoc['price']); } if (isset($assoc['status'])) { $item->setStatus($assoc['status']); } $result[] = $item; } if (!$result) { $item = new Item(); $item->setId($fid . '_0'); $item->setFeed($feed); $item->setType('GLOBAL'); $item->setGlobal($text); $result[] = $item; } return $result; }