Exemplo n.º 1
0
 /**
  * Export stats.
  * @param $groupId
  * @param $type
  * @param $saveTo
  * @return bool
  * @throws \Exception
  */
 public function export($groupId, $type, $saveTo)
 {
     if (!$this->actionParser->groupExists($groupId)) {
         throw new \Exception('Group ID does not exist: ' . $groupId);
     }
     if ($type != 'csv') {
         throw new \Exception('Unknown export type: ' . $type);
     }
     $actions = $this->actionParser->parseGroup($groupId);
     $fullRows = $this->actionParser->getFullRows($actions);
     $fullRows = $this->filterRows($fullRows);
     $this->exportToCSV($fullRows, $saveTo);
     $this->display->outputMessage('Export saved to: ' . $saveTo);
     return true;
 }