Task
in package
implements
EntityInterface
Represents an user defined task on server.
Tags
Table of Contents
Interfaces
- EntityInterface
- Entity interface.
Properties
- $attributes : array<string|int, mixed>
- Attributes of task.
- $connection : Connection
- Connection object.
- $defaultOptions : array<string|int, mixed>
- Default options.
- $id : string
- Task id.
- $isNew : bool
- If the entity is not an representation of a existing task on server, this property is true.
- $type : string
- Task type.
Methods
- __construct() : mixed
- Task constructor.
- delete() : bool
- Removes a task from server, if possible.
- getCommand() : string
- Returns the command.
- getId() : string|null
- Return the Task id.
- getType() : string
- Return the task type.
- hasConnection() : bool
- If this task has a connection set or not.
- isNew() : bool
- If the task object is a new created task (and not exists on server) <br> or if it is a representation of an existing one.
- jsonSerialize() : mixed
- Return a JSON representation of Task object.
- save() : bool
- Saves this task on server, if possible
- setCommand() : void
- Sets the command to task.
- setConnection() : void
- Sets a connection to use.
- setId() : void
- Sets a custom id for task.
- toArray() : array<string|int, mixed>
- Returns a array representation of task.
Properties
$attributes
Attributes of task.
protected
array<string|int, mixed>
$attributes
$connection
Connection object.
protected
Connection
$connection
$defaultOptions
Default options.
protected
array<string|int, mixed>
$defaultOptions
= ['offset' => 30, 'period' => 30, 'params' => []]
$id
Task id.
protected
string
$id
$isNew
If the entity is not an representation of a existing task on server, this property is true.
protected
bool
$isNew
= true
$type
Task type.
protected
string
$type
= 'unknown'
Methods
__construct()
Task constructor.
public
__construct(string $name, string $command[, Connection|null $connection = null ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $name : string
-
Task name.
- $command : string
-
Task command.
- $connection : Connection|null = null
-
Connection to use.
- $options : array<string|int, mixed> = []
-
Additional options for task.
Tags
delete()
Removes a task from server, if possible.
public
delete() : bool
Tags
Return values
bool —True if operation was successful, false otherwise
getCommand()
Returns the command.
public
getCommand() : string
Return values
stringgetId()
Return the Task id.
public
getId() : string|null
Return values
string|null —Task id, if exists or null if the task is a new one.
getType()
Return the task type.
public
getType() : string
Return values
stringhasConnection()
If this task has a connection set or not.
public
hasConnection() : bool
Return values
bool —True of has a connection object. False otherwise.
isNew()
If the task object is a new created task (and not exists on server) <br> or if it is a representation of an existing one.
public
isNew() : bool
Return values
booljsonSerialize()
Return a JSON representation of Task object.
public
jsonSerialize() : mixed
save()
Saves this task on server, if possible
public
save() : bool
Tags
Return values
bool —True if operation was successful, false otherwise
setCommand()
Sets the command to task.
public
setCommand(string $command) : void
Parameters
- $command : string
setConnection()
Sets a connection to use.
public
setConnection(Connection $connection) : void
Parameters
- $connection : Connection
-
Connection object to use.
setId()
Sets a custom id for task.
public
setId(string $id) : void
Parameters
- $id : string
toArray()
Returns a array representation of task.
public
toArray() : array<string|int, mixed>