Ejemplo n.º 1
0
 /**
  * Handle every iteration of the parsing process.
  *
  * @param  \pandaac\Exporter\Contracts\Reader  $reader
  * @param  \Illuminate\Support\Collection  $collection
  * @return \Illuminate\Support\Collection
  */
 public function iteration(Reader $reader, Collection $collection)
 {
     if (!$reader->is('monster')) {
         return $collection;
     }
     if (!($reader->isElement() or $reader->isAttribute() or $reader->isComment())) {
         return $collection;
     }
     // Monster information
     if ($iteration = $this->information($reader)) {
         $collection->push($iteration);
     }
     // Monster details
     if ($this->enabled('recursion') and $iteration = $this->details($reader, $collection)) {
         $monster = $collection->pop();
         return $collection->push($iteration->put('paths', $monster));
     }
     return $collection;
 }