File size: 667 Bytes
f80131c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <?php
declare(strict_types=1);
final class QueueEntry
{
public function __construct(
public readonly string $name,
public readonly string $state,
public readonly string $detail,
) {}
}
function describeEntry(QueueEntry $entry): string
{
return sprintf('%s [%s]: %s', $entry->name, $entry->state, $entry->detail);
}
$entries = [
new QueueEntry('parse', 'complete', 'front matter loaded'),
new QueueEntry('extract', 'review', 'extraction fixture marker: shared code sample'),
new QueueEntry('index', 'pending', 'search document queued'),
];
foreach ($entries as $entry) {
echo describeEntry($entry) . PHP_EOL;
}
|