/** * Main function * @return bool */ private function work() { $this->_logger->log(__METHOD__); try { $this->report = HeartbeatReport::getReport(HeartbeatReport::create($this->period)); $stat = new GetStatistics($this->report); if (!$stat->push($this->report->report_id)) { $this->report->status('push_err'); return false; } $excel_path = $stat->saveExcel($this->report); if ($excel_path === false) { $this->report->status('exel_err'); return false; } $this->report->status('sending'); if ($excel_path !== false && !$this->emailSend($excel_path)) { $this->report->status('email_err'); return false; } if ($excel_path !== false && !$this->ftpSend($excel_path)) { $this->report->ftpStatus('ftp_err'); return false; } return true; } catch (Exception $e) { $this->_logger->log(__METHOD__ . "ERROR: ", $e->getMessage()); return false; } }