chore: complete update

This commit is contained in:
2025-07-17 16:24:20 +02:00
parent 899227b0a4
commit 64a7051137
1300 changed files with 85570 additions and 2756 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace Archive\Optimized;
/**
* Cache-Analyse für Template-Rendering
*/
final readonly class CacheAnalysis
{
public function __construct(
public CacheStrategy $strategy,
public int $ttl,
public array $dependencies = [],
) {}
public function shouldCache(): bool
{
return $this->strategy !== CacheStrategy::DYNAMIC && $this->ttl > 0;
}
public function isUserSpecific(): bool
{
return isset($this->dependencies['user_id']) || isset($this->dependencies['session_id']);
}
public function getComplexity(): int
{
return count($this->dependencies) + ($this->isUserSpecific() ? 5 : 0);
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Archive\Optimized;
/**
* Cache-Strategien für Templates
*/
enum CacheStrategy: string
{
case STATIC = 'static'; // Vollständig statischer Content
case PARTIAL = 'partial'; // Teilweise dynamischer Content
case FRAGMENT = 'fragment'; // Fragment-basiertes Caching
case DYNAMIC = 'dynamic'; // Kein Caching (vollständig dynamisch)
public function getTtl(): int
{
return match($this) {
self::STATIC => 3600, // 1 Stunde
self::PARTIAL => 900, // 15 Minuten
self::FRAGMENT => 600, // 10 Minuten
self::DYNAMIC => 0, // Kein Caching
};
}
public function getPriority(): int
{
return match($this) {
self::STATIC => 1, // Höchste Priorität
self::PARTIAL => 2,
self::FRAGMENT => 3,
self::DYNAMIC => 4, // Niedrigste Priorität
};
}
public function shouldCache(): bool
{
return $this !== self::DYNAMIC;
}
public function getDescription(): string
{
return match($this) {
self::STATIC => 'Fully cacheable static content',
self::PARTIAL => 'Partially cacheable with some dynamic elements',
self::FRAGMENT => 'Fragment-based caching for mixed content',
self::DYNAMIC => 'Fully dynamic content, no caching',
};
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Archive\Optimized;
/**
* Template-Analyse-Ergebnisse
*/
final class TemplateAnalysis
{
public array $staticBlocks = [];
public array $dynamicBlocks = [];
public array $dependencies = [];
public array $optimizations = [];
public CacheStrategy $cacheStrategy = CacheStrategy::DYNAMIC;
public function getComplexity(): int
{
return count($this->staticBlocks) + count($this->dynamicBlocks) * 2;
}
public function isCacheable(): bool
{
return $this->cacheStrategy !== CacheStrategy::DYNAMIC;
}
public function hasFragments(): bool
{
return count($this->staticBlocks) > 0;
}
}