<?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;
    }
}
