TenantAtlas/apps/platform/app/Support/Pdf/PdfByteValidator.php
Ahmed Darrazi a0f376ae7d
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m7s
feat: finish management report PDF staging validation
2026-06-23 20:22:51 +02:00

21 lines
416 B
PHP

<?php
declare(strict_types=1);
namespace App\Support\Pdf;
final class PdfByteValidator
{
public static function isValid(string $bytes): bool
{
if ($bytes === '' || ! str_starts_with($bytes, '%PDF-')) {
return false;
}
$trimmedBytes = rtrim($bytes);
return str_contains($trimmedBytes, 'startxref')
&& str_ends_with($trimmedBytes, '%%EOF');
}
}