PHP Class Crontab\Crontab

Author: Benjamin Laugueux ([email protected])
Datei anzeigen Open project: yzalis/crontab Class Usage Examples

Protected Properties

Property Type Description
$crontabFileHandler CrontabFileHandler
$user string The user executing the comment 'crontab'

Public Methods

Method Description
__construct ( boolean | true $parseExistingCrontab = true ) Constructor
addItem ( Crontab\Job | Variable $item ) : Crontab
addJob ( Crontab\Job $job ) : Crontab Add a new job to the crontab
addVariable ( Variable $variable ) : Crontab
flush ( ) : Crontab Remove all crontab content
getCrontabExecutable ( ) : string Get crontab executable location
getCrontabFileHandler ( ) : CrontabFileHandler Returns a Crontab File Handler
getError ( ) : string Get crontab error
getJobs ( ) : Crontab\Job[] Get all crontab jobs
getOutput ( ) : string Get crontab output
getUser ( ) : string Get unix user to add crontab
getVariables ( ) : Variable[] Get all variables in crontab
parseExistingCrontab ( ) : Crontab Parse an existing crontab
removeAllJobs ( ) : Crontab Remove all job in the current crontab
removeAllVariables ( ) : Crontab
removeJob ( Crontab\Job $job ) : Crontab Remove a specified job in the current crontab
removeVariable ( Variable $variable ) : Crontab
render ( ) : string Render the crontab and associated jobs
setCrontabExecutable ( string $crontabExecutable ) : Crontab Set unix user to add crontab
setCrontabFileHandler ( CrontabFileHandler $command ) Set the Crontab File Handler
setJobs ( array $jobs ) : Crontab Adda new job to the crontab
setUser ( string $user ) : Crontab Set unix user to add crontab
setVariables ( array $variables ) : Crontab
write ( ) Write the current crons in the cron table

Method Details

__construct() public method

Constructor
public __construct ( boolean | true $parseExistingCrontab = true )
$parseExistingCrontab boolean | true

addItem() public method

public addItem ( Crontab\Job | Variable $item ) : Crontab
$item Crontab\Job | Variable
return Crontab

addJob() public method

Add a new job to the crontab
public addJob ( Crontab\Job $job ) : Crontab
$job Crontab\Job
return Crontab

addVariable() public method

public addVariable ( Variable $variable ) : Crontab
$variable Variable
return Crontab

flush() public method

Remove all crontab content
public flush ( ) : Crontab
return Crontab

getCrontabExecutable() public method

Get crontab executable location
Deprecation: Please use {@see \CrontabFileHandler::getCrontabExecutable()}
public getCrontabExecutable ( ) : string
return string

getCrontabFileHandler() public method

Returns a Crontab File Handler
public getCrontabFileHandler ( ) : CrontabFileHandler
return CrontabFileHandler

getError() public method

Get crontab error
Deprecation: Please use {@see \CrontabFileHandler::getError()}
public getError ( ) : string
return string

getJobs() public method

Get all crontab jobs
public getJobs ( ) : Crontab\Job[]
return Crontab\Job[] An array of Job

getOutput() public method

Get crontab output
Deprecation: Please use {@see \CrontabFileHandler::getOutput()}
public getOutput ( ) : string
return string

getUser() public method

Get unix user to add crontab
public getUser ( ) : string
return string

getVariables() public method

Get all variables in crontab
public getVariables ( ) : Variable[]
return Variable[] an array of Variable

parseExistingCrontab() public method

Parse an existing crontab
Deprecation: Please use {@see \CrontabFileHandler::parseExistingCrontab()}
public parseExistingCrontab ( ) : Crontab
return Crontab

removeAllJobs() public method

Remove all job in the current crontab
public removeAllJobs ( ) : Crontab
return Crontab

removeAllVariables() public method

public removeAllVariables ( ) : Crontab
return Crontab

removeJob() public method

Remove a specified job in the current crontab
public removeJob ( Crontab\Job $job ) : Crontab
$job Crontab\Job
return Crontab

removeVariable() public method

public removeVariable ( Variable $variable ) : Crontab
$variable Variable
return Crontab

render() public method

Render the crontab and associated jobs
public render ( ) : string
return string

setCrontabExecutable() public method

Set unix user to add crontab
Deprecation: Please use {@see \CrontabFileHandler::setCrontabExecutable()}
public setCrontabExecutable ( string $crontabExecutable ) : Crontab
$crontabExecutable string
return Crontab

setCrontabFileHandler() public method

Set the Crontab File Handler
public setCrontabFileHandler ( CrontabFileHandler $command )
$command CrontabFileHandler

setJobs() public method

Adda new job to the crontab
public setJobs ( array $jobs ) : Crontab
$jobs array
return Crontab

setUser() public method

Set unix user to add crontab
public setUser ( string $user ) : Crontab
$user string
return Crontab

setVariables() public method

public setVariables ( array $variables ) : Crontab
$variables array
return Crontab

write() public method

Write the current crons in the cron table
Deprecation: Please use {@see \CrontabFileHandler::write()}
public write ( )

Property Details

$crontabFileHandler protected_oe property

protected CrontabFileHandler,crontab $crontabFileHandler
return CrontabFileHandler

$user protected_oe property

The user executing the comment 'crontab'
protected string $user
return string