db = new ImporterDB($importerService->getCredentials()); $this->idMapper = app(IdMapper::class); } /** * The start method. Takes the offset to start from * * @param int $start * * @throws ImporterNoMoreRecords * @throws ImporterNextRecordSet * * @return mixed */ abstract public function run($start = 0); /** * @param $date * * @return Carbon */ protected function parseDate($date) { $carbon = Carbon::parse($date); return $carbon; } /** * Take a decimal duration and convert it to minutes * * @param $duration * * @return float|int */ protected function convertDuration($duration) { if (strpos($duration, '.') !== false) { $delim = '.'; } elseif (strpos($duration, ':')) { $delim = ':'; } else { // no delimiter, assume it's just a straight hour return (int) $duration * 60; } $hm = explode($delim, $duration); $hours = (int) $hm[0] * 60; $mins = (int) $hm[1]; return $hours + $mins; } }