✨feature: Initial MVP
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
// phpcs:disable PEAR.Commenting.FileComment,PEAR.Commenting.ClassComment
|
||||
|
||||
/**
|
||||
* Task domain model.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace IronKanban\Domain;
|
||||
|
||||
/**
|
||||
* Represents a task on the board.
|
||||
*/
|
||||
final class Task
|
||||
{
|
||||
/**
|
||||
* Create a task instance.
|
||||
*
|
||||
* @param string $id Task identifier.
|
||||
* @param string $title Task title.
|
||||
* @param string $projectId Owning project identifier.
|
||||
* @param string $column Column identifier.
|
||||
* @param int $order Sort order within the column.
|
||||
* @param bool $completed Completion flag.
|
||||
* @param string $priority Priority label.
|
||||
* @param bool $isActive Active state flag.
|
||||
* @param string $body Markdown body.
|
||||
* @param array<string, mixed> $meta Additional task metadata.
|
||||
*/
|
||||
public function __construct(
|
||||
public string $id,
|
||||
public string $title,
|
||||
public string $projectId,
|
||||
public string $column,
|
||||
public int $order,
|
||||
public bool $completed,
|
||||
public string $priority,
|
||||
public bool $isActive,
|
||||
public string $body,
|
||||
public array $meta = []
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the task into an API-friendly array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'project_id' => $this->projectId,
|
||||
'column' => $this->column,
|
||||
'order' => $this->order,
|
||||
'completed' => $this->completed,
|
||||
'priority' => $this->priority,
|
||||
'is_active' => $this->isActive,
|
||||
'body' => $this->body,
|
||||
'meta' => $this->meta,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user