timesheet = $timesheet; $this->color = $color; } public function getData(): array { return [ 'description' => $this->timesheet->getDescription(), 'activity' => $this->timesheet->getActivity() !== null ? $this->timesheet->getActivity()->getId() : null, 'project' => $this->timesheet->getProject() !== null ? $this->timesheet->getProject()->getId() : null, 'tags' => implode(',', $this->timesheet->getTagsAsArray()), ]; } public function getTitle(): string { if ($this->timesheet->getActivity() !== null && $this->timesheet->getActivity()->getName() !== null) { return $this->timesheet->getActivity()->getName(); } if (null !== $this->timesheet->getProject() && $this->timesheet->getProject()->getName() !== null) { return $this->timesheet->getProject()->getName(); } return $this->timesheet->getDescription() ?? ''; } public function getColor(): string { return $this->color; } public function getBlockName(): ?string { return 'dd_timesheet'; } public function getActivity(): ?Activity { return $this->timesheet->getActivity(); } public function getProject(): ?Project { return $this->timesheet->getProject(); } }