Files
laraundfelix/app/Domain/Catalog/OfferCoverage.php
LarsandCursor 5e763d15ec
Deploy Test / test (push) Successful in 17s
Deploy Test / deploy (push) Successful in 25s
Ergaenze Stammdaten, Suche, Dimensionen, Abdeckung und Ausgabenachweis
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-16 08:24:23 +01:00

39 lines
919 B
PHP

<?php
namespace App\Domain\Catalog;
class OfferCoverage
{
public function __construct(private readonly ContentResolver $resolver) {}
/**
* @param list<LicenseArticle> $articles
* @return list<string>
*/
public function missingLeaves(CompositionVersion $version, array $articles): array
{
$covered = [];
foreach ($articles as $article) {
$release = $article->currentRelease;
if ($release === null) {
continue;
}
foreach ($release->contents()->pluck('content_element_version_id') as $id) {
$covered[(int) $id] = true;
}
}
$missing = [];
foreach ($this->resolver->expand($version) as $row) {
if (! isset($covered[$row['version_id']])) {
$missing[] = $row['path'];
}
}
return $missing;
}
}