Files
core/src/Export/CsvColumn.php
T

22 lines
674 B
PHP
Raw Normal View History

2026-08-24 21:06:11 +03:00
<?php
namespace Modules\Core\Export;
/**
* One column in a CsvWriter schema: a header label plus a closure that pulls this
* column's value out of one record. The closure doesn't care what shape a record
* is — an array, an Eloquent model, a DTO — so the same CsvWriter serves any
* domain (GDPR export, an admin catalog export, an accounting export) by simply
* being handed a different column schema and a different row source.
*/
final class CsvColumn
{
/**
* @param \Closure(mixed): (string|int|float|null) $value
*/
public function __construct(
public readonly string $header,
public readonly \Closure $value,
) {}
}