Task

class Task

Represents a Task in a Gantt chart

__construct(string $title, string $enduration, ?string $id = null)

Create a new Task

Parameters:
  • $title (string) – Task title

  • $enduration (string) – Task end or duration

Can be:
  • A date in the chart input date format (see GanttChart::withDateFormat)

  • A duration in the form nt where n is an integer and t is a letter indicating the duration unit, e.g. d for days

  • A string in the form until id where id is the id of the task or milestone that this task should end at

Warning

Multiple ids are not supported

Parameters:
  • $id (?string) –

    Task id (default: no id)

    Note

    A task with an id must also have its start set. See withStart

Returns:

A new Task instance

Return type:

Task

withComment(string $comment)

Set a comment for the Task

Parameters:
  • $comment (string) – The comment

Returns:

A new Task instance

Return type:

Task

withInteraction(string $interaction, InteractionType $type, ?string $tooltip = null, InteractionTarget $target = InteractionTarget::Self)

Set an interaction

Note

A task must have an id, and so must have its start set, if it is to have an interaction.

Parameters:
  • $interaction (string) – Interaction text

  • $type (InteractionType) – Interaction type; callback or link

  • $tooltip (?string) – Tooltip text (default: no tooltip)

  • $target (InteractionTarget) – Interaction target (default: current window)

Returns:

A new Task instance with the interaction

Return type:

Task

withStart(string $start) self

Sets the start date of the task

The default (this method not called) is for the task to start immediately after the preceding task

Parameters:
  • $start (string) –

    Task start

    Can be: * A date in the chart input date format (see GanttChart::withDateFormat) * A string in the form after id where id is the id of the task or milestone after which this task should start

    Warning

    Multiple ids are not supported

Returns:

A new Task instance

Return type:

Task

withTag(Tag ...$tag)

Set task status tag(s)

Parameters:
  • ...$tag (Tag) – The tag(s)

Returns:

A new Task instance with the tag(s)

Return type:

Task