canParse($url)) { return $parser; } } throw new Exception("No homepage parser found for URL: {$url}"); } public static function getParserForFeed(Feed $feed): ?HomepageParserInterface { try { return self::getParser($feed->url); } catch (Exception) { return null; } } }