Task.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * Copyright 2026 Alessandro Chiapparini <sprint_planer_web@chiapparini.org>
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * See the LICENSE file in the project root for the full license text.
  9. */
  10. declare(strict_types=1);
  11. namespace App\Domain;
  12. final class Task
  13. {
  14. public function __construct(
  15. public readonly int $id,
  16. public readonly int $sprintId,
  17. public readonly string $title,
  18. public readonly ?int $ownerWorkerId,
  19. public readonly int $priority, // 1 or 2
  20. public readonly int $sortOrder,
  21. public readonly string $createdAt,
  22. public readonly string $updatedAt,
  23. public readonly string $description = '',
  24. public readonly string $url = '',
  25. public readonly ?int $linkedTaskId = null,
  26. ) {
  27. }
  28. public function toAuditSnapshot(): array
  29. {
  30. return [
  31. 'id' => $this->id,
  32. 'sprint_id' => $this->sprintId,
  33. 'title' => $this->title,
  34. 'owner_worker_id' => $this->ownerWorkerId,
  35. 'priority' => $this->priority,
  36. 'sort_order' => $this->sortOrder,
  37. 'created_at' => $this->createdAt,
  38. 'updated_at' => $this->updatedAt,
  39. 'description' => $this->description,
  40. 'url' => $this->url,
  41. 'linked_task_id' => $this->linkedTaskId,
  42. ];
  43. }
  44. }