/** * @param Variable $variable * @return Crontab */ public function removeVariable(Variable $variable) { unset($this->variables[$variable->getHash()]); return $this; }
/** * Returns an array of Cron Jobs based on the contents of a file. * * @param string $input * * @return array of Variable and Job instances */ protected function parseString($input) { $elements = array(); $lines = array_filter(explode(PHP_EOL, $input), function ($line) { return '' != trim($line); }); foreach ($lines as $line) { $trimmed = trim($line); // if line is not a comment, convert it to a cron if (0 !== \strpos($trimmed, '#')) { if (preg_match('/^[^\\s]+\\s?=/', $line)) { $elements[] = Variable::parse($line); } else { $elements[] = Job::parse($line); } } } return $elements; }