Tasks get an ordered checklist (spec 8.2, phase 3): items are checked done with who and when recorded, also by subcontractors attached to the job; others add, rename, reorder and remove items. Items go with their task. The spec gets a phase 3 chapter (18.1), and open questions move to chapter 19. Co-Authored-By: Claude Opus 5.5 <[email protected]>
29 lines
603 B
PHP
29 lines
603 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Jobs\Domain\ValueObjects;
|
|
|
|
use App\Modules\Jobs\Domain\Exceptions\InvalidChecklistItemText;
|
|
|
|
final readonly class ChecklistItemText
|
|
{
|
|
public const int MAX_LENGTH = 255;
|
|
|
|
public string $value;
|
|
|
|
/**
|
|
* @throws InvalidChecklistItemText
|
|
*/
|
|
public function __construct(string $value)
|
|
{
|
|
$value = trim(preg_replace('/\s+/u', ' ', $value) ?? $value);
|
|
|
|
if ($value === '' || mb_strlen($value) > self::MAX_LENGTH) {
|
|
throw new InvalidChecklistItemText;
|
|
}
|
|
|
|
$this->value = $value;
|
|
}
|
|
}
|