fedi-feed-router/app/Services/RoutingValidationService.php
2025-07-05 18:26:04 +02:00

30 lines
No EOL
664 B
PHP

<?php
namespace App\Services;
use App\Exceptions\RoutingMismatchException;
use App\Models\Feed;
use Illuminate\Support\Collection;
class RoutingValidationService
{
/**
* @throws RoutingMismatchException
*/
public function validateLanguageCompatibility(Feed $feed, Collection $channels): void
{
if (! $feed->language) {
return;
}
foreach ($channels as $channel) {
if (! $channel->language) {
continue;
}
if ($feed->language !== $channel->language) {
throw new RoutingMismatchException($feed, $channel);
}
}
}
}