Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ProjectTask | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isCompleted | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Projects\Domain\Model; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | /** |
| 12 | * Domain entity representing a Task within a Project Stage. |
| 13 | * |
| 14 | * @package App\Modules\Projects\Domain\Model |
| 15 | */ |
| 16 | final readonly class ProjectTask |
| 17 | { |
| 18 | /** |
| 19 | * @param int $id Unique identifier of the task. |
| 20 | * @param string $name Task summary or title. |
| 21 | * @param int $projectId Identifier of the associated project. |
| 22 | * @param int $stageId Identifier of the project stage. |
| 23 | * @param string $startDate Scheduled start date and time. |
| 24 | * @param string $endDate Target end date and time. |
| 25 | * @param string $status Execution status code. |
| 26 | * @param string $priority Priority classification. |
| 27 | * @param string $type Task category. |
| 28 | * @param float $estimatedHours Estimated effort in hours. |
| 29 | * @param float $actualHours Actual logged time in hours. |
| 30 | * @param int $progress Task completion percentage (0-100). |
| 31 | * @param string|null $actualEndDate Actual resolution timestamp. |
| 32 | * @param string|null $internalNumber System internal sequence identifier. |
| 33 | * @param int|null $parentTaskId Optional parent task for sub-tasks. |
| 34 | * @param int|null $dependsOnTaskId Predecessor task for Gantt dependency ordering. |
| 35 | * @param int $owner Assigned user identifier. |
| 36 | */ |
| 37 | public function __construct( |
| 38 | public int $id, |
| 39 | public string $name, |
| 40 | public int $projectId, |
| 41 | public int $stageId, |
| 42 | public string $startDate, |
| 43 | public string $endDate, |
| 44 | public string $status = 'planned', |
| 45 | public string $priority = 'normal', |
| 46 | public string $type = 'task', |
| 47 | public float $estimatedHours = 0.0, |
| 48 | public float $actualHours = 0.0, |
| 49 | public int $progress = 0, |
| 50 | public ?string $actualEndDate = null, |
| 51 | public ?string $internalNumber = null, |
| 52 | public ?int $parentTaskId = null, |
| 53 | public ?int $dependsOnTaskId = null, |
| 54 | public int $owner = 1, |
| 55 | ) { |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Determines whether the task is completed. |
| 60 | * |
| 61 | * @return bool True if completed, false otherwise. |
| 62 | */ |
| 63 | public function isCompleted(): bool |
| 64 | { |
| 65 | return $this->status === 'completed' || $this->progress >= 100; |
| 66 | } |
| 67 | } |