/** * @param OutputInterface $output * @param Crontab $crontab * @param string|null $user * * @return mixed */ public function output(OutputInterface $output, Crontab $crontab, $user = null) { $crontab->clearManagedTasks(); $writer = new SystemWriter(array('user' => $user)); $writer->write($crontab); $output->writeln('Your crontab was updated!'); }
/** * @param OutputInterface $output * @param Crontab $crontab * @param string|null $user * * @return mixed */ public function output(OutputInterface $output, Crontab $crontab, $user = null) { $writer = new SystemWriter(array('user' => $user)); //Checking if we do want to save something if not it's better to left file as is if ($crontab->getManagedTasks()) { $writer->write($crontab); $output->writeln('Your crontab has been updated!'); } else { $output->writeln('Your crontab does not need to be updated!'); } }
/** * @param OutputInterface $output * @param Crontab $crontab * @param string|null $user * * @return mixed */ public function output(OutputInterface $output, Crontab $crontab, $user = null) { $writer = new SystemWriter(array('user' => $user)); $output->writeln('<info>Your crontab will look like:</info>'); $output->write('<comment>' . $writer->getContent($crontab) . '</comment>'); }