Constants.php

Code Hygiene Score: 100

Keine Issues gefunden.

Klassen 1

Funktionen 1

Verwendet von 43

Versionen 5

Code

<?php

declare(strict_types=1);

namespace Domain;

// @responsibility: Zentrale benannte Konstanten für Magic Numbers

/**
 * Zentrale Konstanten für das KI-System.
 *
 * Diese Klasse enthält alle häufig verwendeten "Magic Numbers" als
 * benannte Konstanten für bessere Lesbarkeit und Wartbarkeit.
 */
final class Constants
{
    // =========================================================================
    // PAGINATION & LIMITS
    // =========================================================================

    /** Standard-Limit für Datenbankabfragen */
    public const int DEFAULT_LIMIT = 100;

    /** Standard-Seitengröße für Pagination */
    public const int PAGE_SIZE = 50;

    /** Maximum für Batch-Operationen */
    public const int BATCH_LIMIT = 1000;

    /** Standard-Offset für Pagination */
    public const int DEFAULT_OFFSET = 0;

    // =========================================================================
    // TIME CONVERSIONS
    // =========================================================================

    /** Millisekunden pro Sekunde */
    public const int MS_PER_SECOND = 1000;

    /** Sekunden pro Minute */
    public const int SECONDS_PER_MINUTE = 60;

    /** Minuten pro Stunde */
    public const int MINUTES_PER_HOUR = 60;

    /** Stunden pro Tag */
    public const int HOURS_PER_DAY = 24;

    /** Tage pro Jahr */
    public const int DAYS_PER_YEAR = 365;

    /** Sekunden pro Stunde */
    public const int SECONDS_PER_HOUR = 3600;

    /** Sekunden pro Tag */
    public const int SECONDS_PER_DAY = 86400;

    // =========================================================================
    // PERCENTAGES
    // =========================================================================

    /** 100 Prozent (für Berechnungen) */
    public const int PERCENT_FULL = 100;

    /** 50 Prozent */
    public const int PERCENT_HALF = 50;

    // =========================================================================
    // TIMEOUTS (in Sekunden)
    // =========================================================================

    /** Standard-Timeout für HTTP-Requests */
    public const int HTTP_TIMEOUT = 30;

    /** Timeout für LLM-Anfragen */
    public const int LLM_TIMEOUT = 120;

    /** Health-Check Timeout */
    public const int HEALTH_CHECK_TIMEOUT = 5;

    // =========================================================================
    // FIELD VALIDATION
    // =========================================================================

    /** Maximale Länge für Name-Felder */
    public const int NAME_MAX_LENGTH = 100;

    /** Maximale Länge für Titel-Felder */
    public const int TITLE_MAX_LENGTH = 200;

    /** Minimale Token-Anzahl für LLM-Requests */
    public const int MIN_TOKENS = 100;

    /** Maximale Token-Anzahl für LLM-Requests */
    public const int MAX_TOKENS = 16000;

    // =========================================================================
    // CHUNKING & TEXT
    // =========================================================================

    /** Minimale Chunk-Größe in Zeichen */
    public const int MIN_CHUNK_SIZE = 100;

    /** Maximale Chunk-Größe in Zeichen */
    public const int MAX_CHUNK_SIZE = 2000;

    /** Chunk-Overlap in Prozent */
    public const int CHUNK_OVERLAP_PERCENT = 10;

    /** Maximale Länge für Embedding-Text */
    public const int EMBEDDING_TEXT_LIMIT = 1000;

    /** Maximale Länge für vollständigen Embedding-Payload */
    public const int EMBEDDING_PAYLOAD_LIMIT = 1800;

    // =========================================================================
    // RETRY & BACKOFF
    // =========================================================================

    /** Maximale Anzahl Wiederholungsversuche */
    public const int MAX_RETRIES = 3;

    /** Basis für exponentielles Backoff in Sekunden */
    public const int RETRY_BACKOFF_BASE = 2;

    // =========================================================================
    // SCORE THRESHOLDS
    // =========================================================================

    /** Minimum-Score für "gut" */
    public const int SCORE_GOOD = 80;

    /** Minimum-Score für "akzeptabel" */
    public const int SCORE_ACCEPTABLE = 60;

    /** Hard-Fail Score bei kritischen Issues */
    public const int SCORE_HARD_FAIL = 20;

    // Keine Instanziierung erlaubt
    private function __construct()
    {
    }
}
← Übersicht Graph