protected function inspect(Feed $feed)
 {
     while ($item = $feed->getNextItem()) {
         foreach ($item->all() as $key => $value) {
             if (!array_key_exists($key, $this->data)) {
                 $this->data[$key] = [];
             }
             $hash = md5(serialize($value));
             if (!array_key_exists($hash, $this->data[$key])) {
                 $this->data[$key][$hash] = 0;
             }
             $this->data[$key][$hash]++;
             if (!array_key_exists($hash, $this->values)) {
                 $this->values[$hash] = $value;
             }
         }
     }
 }
Example #2
0
 /**
  * Returns the next item in the feed, or null if no more items are left.
  * Use this when iterating over the feed.
  *
  * @param  Feed             $feed
  * @return FeedItemBag|null
  */
 public function getNextItem(Feed $feed)
 {
     try {
         return $feed->getNextItem();
     } catch (\Exception $exception) {
         $this->handleException($exception);
     }
     return null;
 }