/** * Constructor * * @param AnalyticsOverview $overview * * @return array */ protected function getTimestamps(AnalyticsOverview &$overview) { // if yearoverview set the begin time to the first day of this year $profileStartDate = explode('T', $this->configHelper->getActiveProfile()['created'])[0]; if ($overview->getUseYear()) { $begin_date = date('Y-m-d', mktime(0, 0, 0, 1, 1, date('Y'))); $begin = strtotime($profileStartDate) > strtotime($begin_date) ? date('Y-m-d', strtotime($profileStartDate)) : $begin_date; } else { // check if timespan is't more than existence of the profile; if so, use the creation time in stead of the timespan time $begin = strtotime($profileStartDate) > strtotime('-' . $overview->getTimespan() . ' days') ? date('Y-m-d', strtotime($profileStartDate)) : date('Y-m-d', strtotime('-' . $overview->getTimespan() . ' days')); } // set the end time $end = date('Y-m-d', strtotime('-' . $overview->getStartOffset() . ' days')); return array('begin' => $begin, 'end' => $end); }