fedi-feed-router/app/Services/RoutingValidationService.php
myrmidex 6784af2ff6
Some checks failed
CI / ci (push) Failing after 4m31s
25 - Fix all PHPStan errors and add mockery extension
2026-03-08 14:18:28 +01:00

33 lines
763 B
PHP

<?php
namespace App\Services;
use App\Exceptions\RoutingMismatchException;
use App\Models\Feed;
use App\Models\PlatformChannel;
use Illuminate\Support\Collection;
class RoutingValidationService
{
/**
* @param Collection<int, PlatformChannel> $channels
*
* @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);
}
}
}
}