Crontab\CrontabFileHandler::parseString PHP Method

parseString() protected method

Returns an array of Cron Jobs based on the contents of a file.
protected parseString ( string $input ) : array
$input string
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;
    }