Erweitere die Klassen

This commit is contained in:
2025-06-19 14:23:00 +02:00
parent cf6eff6ab0
commit 532c0d60e8
8 changed files with 73 additions and 31 deletions
+17 -4
View File
@@ -10,8 +10,9 @@ use JetBrains\PhpStorm\ArrayShape;
class WorkingHours implements ModelInterface
{
protected ?DateTime $workingDay = null;
protected ?DateTime $workingDay = null;
protected ?DateInterval $workingTime = null;
protected bool $isHomeOffice = false;
public function getWorkingDay(): ?DateTime
{
@@ -35,15 +36,27 @@ class WorkingHours implements ModelInterface
return $this;
}
public function isHomeOffice(): bool
{
return $this->isHomeOffice;
}
public function setIsHomeOffice(bool $isHomeOffice): WorkingHours
{
$this->isHomeOffice = $isHomeOffice;
return $this;
}
/**
* @return array<string, string>
*/
#[ArrayShape(['workingDay' => "string", 'workingTime' => "string"])]
#[ArrayShape(['workingDay' => "string", 'workingTime' => "string", 'isHomeOffice' => "boolean"])]
public function jsonSerialize(): array
{
return [
'workingDay' => $this->getWorkingDay()->format('Y-m-d'),
'workingTime' => $this->getWorkingTime()->format('%H:%I:%S')
'workingDay' => $this->getWorkingDay()->format('Y-m-d'),
'workingTime' => $this->getWorkingTime()->format('%H:%I:%S'),
'isHomeOffice' => $this->isHomeOffice(),
];
}
}