hasDynamicComponents = $this->findDynamicComponentsInString($template, $analysis); $analysis->hasUserSpecificContent = $this->findUserContentInString($template, $context); $analysis->hasFormElements = $this->findFormsInString($template); $analysis->hasTimeBasedContent = $this->findTimeBasedContent($template); $analysis->hasSessionData = $this->findSessionData($template, $context); // Fragment-Analyse hinzufügen $this->autoDetectFragments($template, $analysis); // Bestimme beste Cache-Strategie $analysis->cacheStrategy = $this->determineBestStrategy($analysis); $analysis->ttl = $this->calculateOptimalTtl($analysis); $analysis->dependencies = $this->identifyDependencies($analysis, $context); } catch (\Exception $e) { // Bei Fehlern: Konservativ statisches Caching $analysis->cacheStrategy = CacheStrategy::STATIC; $analysis->ttl = 300; } return $analysis; } private function findDynamicComponentsInString(string $template, CacheabilityInfo $analysis): bool { $hasDynamic = false; foreach (self::DYNAMIC_COMPONENTS as $component) { if (str_contains($template, $component)) { $analysis->dynamicComponents[] = $component; $hasDynamic = true; } } return $hasDynamic; } private function findUserContentInString(string $template, RenderContext $context): bool { // Suche nach user-spezifischen Patterns $userPatterns = ['{{user', '$user', 'data-user', 'class="user-']; if (array_any($userPatterns, fn($pattern) => str_contains($template, $pattern))) { return true; } // Prüfe Context-Daten auf User-Informationen return isset($context->data['user']) || isset($context->data['session']); } private function findFormsInString(string $template): bool { return str_contains($template, '