承接 gravitask/task 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gravitask/task

Composer 安装命令:

composer require gravitask/task

包简介

The task logic, parsing, and formatting functionality of Gravitask.

README 文档

README

Build Status

A seriously powerful library for working with TODO list items and tasks.

Features

Example

$parser = new Gravitask\Task\Parser\TodoTxtParser();

$input = "(A) Write the README file";
$task = $parser->parse($input);

$task->getPriority(); // Result: "A"
$task->getTask(); // Result: "Write the README file"

Installation

The recommended way to install this library is via Composer:

composer require gravitask/task

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
$taskItem->setTask("Make another coffee");

getTask()

Retrieve the name/description of the task.

Example
$task->getTask();
// "Make another coffee"

setContexts(array $contexts)

Set the task's contexts to the items provided in the $contexts array.

Example
$contexts = ['email', 'computer'];
$task->setContexts($contexts);

addContext($context)

Append a single context item to the pre-existing array of contexts.

Example
$contexts = ['email'];
$task->setContexts($contexts);

$task->addContext('computer');

getContexts()

Retrieve an array of the task's contexts.

Example
$contexts = ['email', 'computer'];
$task->setContexts($contexts);

$task->getContexts();
// ['email', 'computer']

setProjects(array $projects)

Set the task's projects to the items provided in the $projects array.

Example
$projects = ['SecretProject'];
$task->setProjects($projects);

addProject($project)

Append a single project item to the pre-existing array of projects.

Example
$projects = ['SecretProject'];
$task->setProjects($projects);

$task->addProject('Work');

getProjects()

Retrieve an array of the task's projects.

Example
$projects = ['SecretProject'];

$task->setProjects($projects);
$task->addProject('Work');

$task->getProjects();
// ['SecretProject', 'Work']

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
$creationDate = new \DateTime::createFromFormat("Y-m-d", "2016-08-16");
$task->setCreationDate($creaionDate);

getCreationDate()

Retrieve the optional creation date value for the task.

Example
$task->getCreationDate();
// \DateTime object

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.

$task->setStatus(TaskItem::STATUS_COMPLETED);
$completionDate = new \DateTime::createFromFormat("Y-m-d", "2016-08-20");
$task->setCompletionDate($completionDate);

getCompletionDate()

Retrieve the date that the task was completed.

Example
$task->setStatus(TaskItem::STATUS_COMPLETED);
$completionDate = new \DateTime::createFromFormat("Y-m-d", "2016-08-20");
$task->setCompletionDate($completionDate);

$task->getCompletionDate()
// \DateTime object

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
$task->setPriority("B");

getPriority()

Retrieve the task's priority value represented by a single, uppercase letter of the alphabet.

Example
$task->setPriority("F");

$task->getPriority();
// "F"

setStatus($status)

Set the status of the task to a different value.

Requirements:

  • You should ONLY use the values provided as TaskItem constants beginning with STATUS_.
Example
$task->setStatus(TaskItem::STATUS_COMPLETED);

getStatus()

Retrieve the current status of the task. By default this value will be TaskItem::STATUS_ACTIVE.

Example
$task->setStatus(TaskItem::STATUS_COMPLETED);

$task->getStatus();
// Integer value representation of the status ENUM.

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
$task->setPriority("A");
$task->setTask("Write example code");

$formatter = new Gravitask\Task\Formatter\TodoTxtFormatter();

$output = $formatter->format($task);
// "(A) Write example code"

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.

Example
$parser = new Gravitask\Task\Parser\TodoTxtParser();

$input = "(A) Write the README file";
$task = $parser->parse($input);

$task->getPriority(); // Result: "A"
$task->getTask(); // Result: "Write the README file"

统计信息

  • 总下载量: 26
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固