コード例 #1
0
ファイル: ClearCommand.php プロジェクト: Hexmedia/Crontab
 /**
  * @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!');
 }
コード例 #2
0
 /**
  * @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!');
     }
 }
コード例 #3
0
ファイル: EchoCommand.php プロジェクト: Hexmedia/Crontab
 /**
  * @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>');
 }