fix: complete InvesteMoz validation and error corrections

This commit is contained in:
2026-10-29 21:47:33 +02:00
parent 63147312e2
commit daf8623441
718 changed files with 127308 additions and 20959 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Support;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Collection;
use Traversable;
use UnexpectedValueException;
final class StructuredData
{
/** @return array<array-key, mixed> */
public static function collectionItems(mixed $value): array
{
if ($value instanceof Collection) {
return $value->all();
}
if ($value instanceof Traversable) {
return iterator_to_array($value);
}
if ($value instanceof Arrayable) {
return $value->toArray();
}
if (! is_array($value)) {
throw new UnexpectedValueException('Structured data must contain an array; original data has been preserved.');
}
return $value;
}
}