PHP Class mult1mate\crontab\TaskManager

Author: mult1mate
Datei anzeigen Open project: MUlt1mate/cron-manager Class Usage Examples

Public Methods

Method Description
editTask ( mult1mate\crontab\TaskInterface $task, string $time, string $command, string $status = TaskInterface::TASK_STATUS_ACTIVE, string $comment = null ) : mult1mate\crontab\TaskInterface Edit and save TaskInterface object
getTaskCrontabLine ( mult1mate\crontab\TaskInterface $task, string $path, string $php_bin, string $input_file ) : string Formats task for export into crontab file
parseCommand ( string $command ) : array Parses command and returns an array which contains class, method and arguments of the command
parseCrontab ( string $cron, mult1mate\crontab\TaskInterface $task_class ) : array Parses each line of crontab content and creates new TaskInterface objects
validateCommand ( string $command ) : string | false Checks if the command is correct and removes spaces

Private Methods

Method Description
createTaskWithCrontabLine ( mult1mate\crontab\TaskInterface $task_class, array $matches, string $comment ) : mult1mate\crontab\TaskInterface Creates new TaskInterface object from parsed crontab line

Method Details

editTask() public static method

Edit and save TaskInterface object
public static editTask ( mult1mate\crontab\TaskInterface $task, string $time, string $command, string $status = TaskInterface::TASK_STATUS_ACTIVE, string $comment = null ) : mult1mate\crontab\TaskInterface
$task mult1mate\crontab\TaskInterface
$time string
$command string
$status string
$comment string
return mult1mate\crontab\TaskInterface

getTaskCrontabLine() public static method

Formats task for export into crontab file
public static getTaskCrontabLine ( mult1mate\crontab\TaskInterface $task, string $path, string $php_bin, string $input_file ) : string
$task mult1mate\crontab\TaskInterface
$path string
$php_bin string
$input_file string
return string

parseCommand() public static method

Parses command and returns an array which contains class, method and arguments of the command
public static parseCommand ( string $command ) : array
$command string
return array

parseCrontab() public static method

Parses each line of crontab content and creates new TaskInterface objects
public static parseCrontab ( string $cron, mult1mate\crontab\TaskInterface $task_class ) : array
$cron string
$task_class mult1mate\crontab\TaskInterface
return array

validateCommand() public static method

Checks if the command is correct and removes spaces
public static validateCommand ( string $command ) : string | false
$command string
return string | false