TaskComment.php
- Pfad:
src/Domain/Entity/TaskComment.php - Namespace: Domain\Entity
- Zeilen: 196 | Größe: 4,884 Bytes
- Geändert: 2025-12-23 08:07:55 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 88
- Dependencies: 100 (25%)
- LOC: 52 (20%)
- Methods: 90 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Klassen 1
-
TaskCommentclass Zeile 9
Funktionen 21
-
__construct()public Zeile 20 -
getId()public Zeile 26 -
getTaskId()public Zeile 31 -
getAuthor()public Zeile 36 -
getAuthorType()public Zeile 41 -
getCommentType()public Zeile 46 -
getContent()public Zeile 51 -
getMetadata()public Zeile 56 -
getCreatedAt()public Zeile 61 -
setId()public Zeile 67 -
setTaskId()public Zeile 74 -
setAuthor()public Zeile 81 -
setAuthorType()public Zeile 88 -
setCommentType()public Zeile 95 -
setContent()public Zeile 102 -
setMetadata()public Zeile 109 -
setCreatedAt()public Zeile 116 -
toArray()public Zeile 123 -
fromArray()public Zeile 137 -
createStatusChange()public Zeile 170 -
createAssignmentNote()Zeile 183
Verwendet von 6
- AssignTaskUseCase.php use
- CreateTaskUseCase.php use
- SaveTaskResultUseCase.php use
- TaskCommentRepository.php use
- TaskCommentRepositoryInterface.php use
- UpdateTaskStatusUseCase.php use
Versionen 1
-
v1
2025-12-23 08:07 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php
declare(strict_types=1);
namespace Domain\Entity;
// @responsibility: Task-Kommentar-Entität
class TaskComment
{
private ?int $id = null;
private int $taskId;
private string $author;
private string $authorType = 'human';
private string $commentType = 'comment';
private string $content;
private array $metadata = [];
private \DateTimeImmutable $createdAt;
public function __construct()
{
$this->createdAt = new \DateTimeImmutable();
}
// Getters
public function getId(): ?int
{
return $this->id;
}
public function getTaskId(): int
{
return $this->taskId;
}
public function getAuthor(): string
{
return $this->author;
}
public function getAuthorType(): string
{
return $this->authorType;
}
public function getCommentType(): string
{
return $this->commentType;
}
public function getContent(): string
{
return $this->content;
}
public function getMetadata(): array
{
return $this->metadata;
}
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
// Setters
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function setTaskId(int $taskId): self
{
$this->taskId = $taskId;
return $this;
}
public function setAuthor(string $author): self
{
$this->author = $author;
return $this;
}
public function setAuthorType(string $authorType): self
{
$this->authorType = $authorType;
return $this;
}
public function setCommentType(string $commentType): self
{
$this->commentType = $commentType;
return $this;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function setMetadata(array $metadata): self
{
$this->metadata = $metadata;
return $this;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function toArray(): array
{
return [
'id' => $this->id,
'task_id' => $this->taskId,
'author' => $this->author,
'author_type' => $this->authorType,
'comment_type' => $this->commentType,
'content' => $this->content,
'metadata' => $this->metadata,
'created_at' => $this->createdAt->format('Y-m-d H:i:s.u'),
];
}
public static function fromArray(array $data): self
{
$comment = new self();
if (isset($data['id'])) {
$comment->setId((int) $data['id']);
}
if (isset($data['task_id'])) {
$comment->setTaskId((int) $data['task_id']);
}
if (isset($data['author'])) {
$comment->setAuthor($data['author']);
}
if (isset($data['author_type'])) {
$comment->setAuthorType($data['author_type']);
}
if (isset($data['comment_type'])) {
$comment->setCommentType($data['comment_type']);
}
if (isset($data['content'])) {
$comment->setContent($data['content']);
}
if (isset($data['metadata'])) {
$metadata = is_string($data['metadata']) ? json_decode($data['metadata'], true) : $data['metadata'];
$comment->setMetadata($metadata ?? []);
}
if (isset($data['created_at'])) {
$comment->setCreatedAt(new \DateTimeImmutable($data['created_at']));
}
return $comment;
}
public static function createStatusChange(int $taskId, string $author, string $authorType, string $oldStatus, string $newStatus): self
{
$comment = new self();
$comment->setTaskId($taskId);
$comment->setAuthor($author);
$comment->setAuthorType($authorType);
$comment->setCommentType('status_change');
$comment->setContent("Status geändert: {$oldStatus} → {$newStatus}");
$comment->setMetadata(['old_status' => $oldStatus, 'new_status' => $newStatus]);
return $comment;
}
public static function createAssignmentNote(int $taskId, string $author, string $authorType, string $assignee, string $assigneeType): self
{
$comment = new self();
$comment->setTaskId($taskId);
$comment->setAuthor($author);
$comment->setAuthorType($authorType);
$comment->setCommentType('assignment');
$comment->setContent("Zugewiesen an {$assignee} ({$assigneeType})");
$comment->setMetadata(['assignee' => $assignee, 'assignee_type' => $assigneeType]);
return $comment;
}
}