Example #1
0
 /**
  * {@inheritdoc}
  */
 public function generateSnapshots(Response $response, $url)
 {
     $start = \DateTime::createFromFormat('U', mktime(0, 0, 0, 1, 1, $this->year));
     $snapshots = new SnapshotCollection($start, $start->add(new \DateInterval('P1Y')));
     foreach ($this->getDates($response) as $date) {
         $snapshot = new Snapshot($date, self::BASE_URL . sprintf('%s/%s', $date->format('YmdHis'), $url));
         $snapshots->getSnapshots()->append($snapshot);
     }
     return $snapshots;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function generateSnapshots(Response $response, $url)
 {
     $dates = $this->getMetaData($response);
     if (!$dates) {
         return null;
     }
     $snapshots = new SnapshotCollection(current($dates)->getDate(), end($dates)->getDate());
     $snapshots->getSnapshots()->exchangeArray($dates);
     return $snapshots;
 }