/** * remove a job * * @param string $job * @return $this */ public function removeJob($job = '') { if ($job instanceof TaskReposity) { $job = $job->buildCommandWithExpression(); } $refrector = new CronEntry(); $job = $refrector->parse($job); $this->getManager()->removeJob($job); return $this; }
/** * Remove a specified job in the current crontab * * @param Job $job * * @return Crontab */ public function removeJob(Job $job) { unset($this->jobs[$job->getHash()]); return $this; }
/** * Returns an array of Cron Jobs based on the contents of a file. * * @param string $input * * @return Job[] */ protected function parseString($input) { $jobs = array(); $lines = array_filter(explode(PHP_EOL, $input), function ($line) { return '' != trim($line); }); foreach ($lines as $line) { $trimmed = trim($line); if (strstr($line, 'PATH=') || strstr($line, 'MAILTO=')) { continue; } // if line is not a comment, convert it to a cron if (0 !== \strpos($trimmed, '#')) { $jobs[] = Job::parse($line); } } return $jobs; }