mult1mate\crontab\TaskManager::createTaskWithCrontabLine PHP Method

createTaskWithCrontabLine() private static method

Creates new TaskInterface object from parsed crontab line
private static createTaskWithCrontabLine ( mult1mate\crontab\TaskInterface $task_class, array $matches, string $comment ) : mult1mate\crontab\TaskInterface
$task_class mult1mate\crontab\TaskInterface
$matches array
$comment string
return mult1mate\crontab\TaskInterface
    private static function createTaskWithCrontabLine($task_class, $matches, $comment)
    {
        $task = $task_class::createNew();
        $task->setTime(trim($matches[2]));
        $arguments = str_replace(' ', ',', trim($matches[5]));
        $command = ucfirst($matches[3]) . '::' . $matches[4] . '(' . $arguments . ')';
        $task->setCommand($command);
        if (!empty($comment)) {
            $task->setComment($comment);
        }
        //$output = $matches[7];
        $status = empty($matches[1]) ? TaskInterface::TASK_STATUS_ACTIVE : TaskInterface::TASK_STATUS_INACTIVE;
        $task->setStatus($status);
        $task->setTs(date('Y-m-d H:i:s'));
        $task->taskSave();
        return $task;
    }