Example #1
0
 /**
  * @param QueryRequest $queryRequest
  * @return array
  * @throws \QCharts\CoreBundle\Exception\SnapshotException
  */
 public function getSnapshotsFormatted(QueryRequest $queryRequest)
 {
     $this->snapshotManager->init();
     $this->snapshotManager->setQueryRequest($queryRequest);
     $snapshots = $this->snapshotManager->getSnapshotNames();
     $friendlyFormat = array_map(function ($s) {
         $s = substr($s, 0, -4);
         //remove the file type
         $date = new \DateTime();
         $date->setTimestamp($s);
         return $date->format(SnapshotService::FRIENDLY_FILE_NAME);
     }, $snapshots);
     $snapshots = array_map(function ($s) {
         return substr($s, 0, -4);
     }, $snapshots);
     $results = array_combine($snapshots, $friendlyFormat);
     return $results;
 }