$url], [ 'feed_id' => $feedId, 'title' => $this->generateFallbackTitle($url), ] ); if ($article->wasRecentlyCreated) { $article->dispatchFetchedEvent(); } return $article; } catch (Exception $e) { $this->logSaver->error('Failed to create article', null, [ 'url' => $url, 'feed_id' => $feedId, 'error' => $e->getMessage(), ]); throw $e; } } private function generateFallbackTitle(string $url): string { $path = parse_url($url, PHP_URL_PATH); $filename = basename($path ?: $url); $title = preg_replace('/\.[^.]*$/', '', $filename); $title = str_replace(['-', '_'], ' ', $title); $title = ucwords($title); return $title ?: 'Untitled Article'; } }