Menu

## Task
in package
implements EntityInterface

Task.php : 22

Represents an user defined task on server.

##### Tags

author

  Lucas S. Vieira

### Table of Contents

#### Interfaces

EntityInterface
  Entity interface.

#### 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() : array<string|int, mixed>|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() : mixed
  Sets a connection to use.
setId() : void
  Sets a custom id for task.
toArray() : array<string|int, mixed>
  Returns a array representation of task.

### Methods

#### __construct()

Task.php : 81

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

throws
  InvalidParameterException|MissingParameterException

#### delete()

Task.php : 238

Removes a task from server, if possible.

`public delete() : bool`

##### Tags

throws
  ServerException|GuzzleException

##### Return values

bool —

True if operation was successful, false otherwise

#### getCommand()

Task.php : 137

Returns the command.

`public getCommand() : string`

##### Return values

string

#### getId()

Task.php : 117

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()

Task.php : 127

Return the task type.

`public getType() : string`

##### Return values

string

#### hasConnection()

Task.php : 157

If this task has a connection set or not.

`public hasConnection() : bool`

##### Return values

bool —

True of has a connection object. False otherwise.

#### isNew()

Task.php : 107

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

bool

#### jsonSerialize()

Task.php : 264

Return a JSON representation of Task object.

`public jsonSerialize() : array<string|int, mixed>|mixed`

##### Return values

array<string|int, mixed>|mixed

#### save()

Task.php : 200

Saves this task on server, if possible

`public save() : bool`

##### Tags

throws
  ServerException|GuzzleException

##### Return values

bool —

True if operation was successful, false otherwise

#### setCommand()

Task.php : 177

Sets the command to task.

`public setCommand(string $command) : void`

##### Parameters

$command : string

#### setConnection()

Task.php : 188

Sets a connection to use.

`public setConnection(Connection $connection) : mixed`

##### Parameters

$connection : Connection

  Connection object to use.

#### setId()

Task.php : 167

Sets a custom id for task.

`public setId(string $id) : void`

##### Parameters

$id : string

#### toArray()

Task.php : 147

Returns a array representation of task.

`public toArray() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

## Search results