/** * Get status records, parse new records * and remove processed xml files * * @throws \Exception */ public function collection(\Closure $on_remove_record = null) { $finder = new Finder(); $finder->files()->in($this->source); if ($finder->files()->count()) { $parser = new Parser($finder, function ($file) { assert(\phpQuery::newDocumentFileXML($file), 'Can not create php query object'); $record = new Record(); $record->setName(pq('task')->text()); $record->setDate(pq('date')->text()); $record->setStatus(pq('status')->text()); $record->setNotice(pq('notice')->text()); $record->setError(pq('error')->text()); $record->setFatal(pq('fatal')->text()); $record->setLog(pq('log')->text()); return $record; }); $this->cache->refresh($parser->collection(), $on_remove_record); } return $this->cache->load(); }
/** * Transform record to category * * @param Record $record */ public function transform(Record $record) { return $record->getStatus(); }