Lint
This commit is contained in:
parent
c7618b0545
commit
adc78a65e7
|
|
@ -31,7 +31,7 @@ class CreateExcelDocumentAction
|
||||||
private function allSheet(Collection $participants): TableDocumentData
|
private function allSheet(Collection $participants): TableDocumentData
|
||||||
{
|
{
|
||||||
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
|
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
|
||||||
$headers = $this->form->getFields()->map(fn ($field) => $field->name)->push('Abgemeldet am')->prepend('ID')->toArray();
|
$headers = $this->form->getFields()->names()->push('Abgemeldet am')->prepend('ID')->toArray();
|
||||||
[$activeParticipants, $cancelledParticipants] = $participants->partition(fn ($participant) => $participant->cancelled_at === null);
|
[$activeParticipants, $cancelledParticipants] = $participants->partition(fn ($participant) => $participant->cancelled_at === null);
|
||||||
|
|
||||||
$document->addSheet(SheetData::from([
|
$document->addSheet(SheetData::from([
|
||||||
|
|
@ -68,7 +68,7 @@ class CreateExcelDocumentAction
|
||||||
|
|
||||||
/** @return array<string, mixed> */
|
/** @return array<string, mixed> */
|
||||||
public function rowFor(Participant $participant): array {
|
public function rowFor(Participant $participant): array {
|
||||||
return $this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw())
|
return $participant->getFields()->presentValues()
|
||||||
->put('Abgemeldet am', $participant->cancelled_at?->format('d.m.Y H:i:s') ?: '')
|
->put('Abgemeldet am', $participant->cancelled_at?->format('d.m.Y H:i:s') ?: '')
|
||||||
->prepend('ID', $participant->id)
|
->prepend('ID', $participant->id)
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
|
||||||
|
|
@ -99,19 +99,19 @@ class FieldCollection extends Collection
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<int, string>
|
* @return Collection<int, string>
|
||||||
*/
|
*/
|
||||||
public function names(): array
|
public function names(): Collection
|
||||||
{
|
{
|
||||||
return $this->map(fn ($field) => $field->name)->toArray();
|
return $this->map(fn ($field) => $field->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<int, string>
|
* @return Collection<string, string>
|
||||||
*/
|
*/
|
||||||
public function presentValues(): array
|
public function presentValues(): Collection
|
||||||
{
|
{
|
||||||
return $this->map(fn ($field) => $field->presentRaw())->toArray();
|
return $this->mapWithKeys(fn ($field) => [$field->name => $field->present()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasSpecialType(SpecialType $specialType): bool
|
public function hasSpecialType(SpecialType $specialType): bool
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue