Download the PHP package gravitask/task without Composer
On this page you can find all versions of the php package gravitask/task. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package task
gravitask/task
A seriously powerful library for working with TODO list items and tasks.
Features
- Parse and format
TaskItem
objects to and from JSON, and todo.txt format.
Example
Installation
The recommended way to install this library is via Composer:
Requirements
- PHP >= 5.4
TaskItem
This class is the "task object" and holds all of the information about the task, such as its creation date, priority, description, etc.
Constants
Name | Definition |
---|---|
STATUS_ACTIVE |
The status of the task is active - i.e. in progress, not completed. |
STATUS_COMPLETED |
The status of the task is completed. |
Methods
setTask($task)
Set the name/description of the task to be completed.
Example
getTask()
Retrieve the name/description of the task.
Example
setContexts(array $contexts)
Set the task's contexts to the items provided in the $contexts
array.
Example
addContext($context)
Append a single context item to the pre-existing array of contexts.
Example
getContexts()
Retrieve an array of the task's contexts.
Example
setProjects(array $projects)
Set the task's projects to the items provided in the $projects
array.
Example
addProject($project)
Append a single project item to the pre-existing array of projects.
Example
getProjects()
Retrieve an array of the task's projects.
Example
setCreationDate(\DateTime $date)
Set the task's optional creation date.
The $date
argument is a DateTime
object set to the required date and time.
Example
getCreationDate()
Retrieve the optional creation date value for the task.
Example
setCompletionDate(\DateTime $date)
Set the date of when the task was completed.
The $date
argument is a DateTime
object set to the required date and time.
getCompletionDate()
Retrieve the date that the task was completed.
Example
setPriority($priority)
Set the task's priority to the provided uppercase single letter of the alphabet. A
signifies the highest priority, whilst Z
represents the lowest.
Example
getPriority()
Retrieve the task's priority value represented by a single, uppercase letter of the alphabet.
Example
setStatus($status)
Set the status of the task to a different value.
Requirements:
- You should ONLY use the values provided as
TaskItem
constants beginning withSTATUS_
.
Example
getStatus()
Retrieve the current status of the task. By default this value will be
TaskItem::STATUS_ACTIVE
.
Example
Formatters
Required Methods
All formatters MUST implement the
Gravitask\Task\Formatter\FormatterInterface
.
format(TaskItem $taskItem)
Format the provided TaskItem
using the preferred formatter class, e.g. TodoTxtFormatter
.
Example
Parsers
Required Methods
All parsers MUST implement the
Gravitask\Task\Parser\ParserInterface
.
parse($input)
Parse the provided $input
variable and return a Gravitask\Task\TaskItem
object,
or FALSE
on failure to parse.