Files
michaelschiemer/tests/debug/debug-capacities.php
Michael Schiemer 55a330b223 Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
2025-08-11 20:13:26 +02:00

34 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../../vendor/autoload.php';
use App\Framework\QrCode\ErrorCorrectionLevel;
use App\Framework\QrCode\QrCodeVersion;
use App\Framework\QrCode\ReedSolomon\ReedSolomonEncoder;
echo "=== Capacity Comparison ===\n\n";
for ($version = 1; $version <= 5; $version++) {
$qrVersion = new QrCodeVersion($version);
echo "Version $version:\n";
foreach ([ErrorCorrectionLevel::L, ErrorCorrectionLevel::M] as $errorLevel) {
$qrCapacity = $qrVersion->getDataCapacity($errorLevel);
$rsCapacity = ReedSolomonEncoder::getDataCapacity($version, $errorLevel->value);
echo " {$errorLevel->value}: QrCodeVersion={$qrCapacity} bits (" . ($qrCapacity / 8) . " bytes), ";
echo "ReedSolomon={$rsCapacity} codewords\n";
// Check if they match when converted
if (($qrCapacity / 8) != $rsCapacity) {
echo " ❌ MISMATCH: " . ($qrCapacity / 8) . " bytes vs $rsCapacity codewords\n";
} else {
echo " ✅ MATCH\n";
}
}
echo "\n";
}