<?php

require __DIR__ . '/../../vendor/autoload.php';

use App\Framework\SyntaxHighlighter\FileHighlighter;

$highlighter = new FileHighlighter();
$html = $highlighter('/var/www/html/src/Domain/Media/ImageSlotRepository.php', 12, 5, 14);

// Find line 14 in the output
$lines = explode('<div class="line', $html);
foreach ($lines as $line) {
    if (str_contains($line, 'Line 14')) {
        echo "Found line 14:\n";
        echo '<div class="line' . $line . "\n\n";

        // Extract just the code part
        preg_match('/<span class="code">(.*?)<\/span>/s', $line, $matches);
        if (isset($matches[1])) {
            echo "Code content:\n";
            echo $matches[1] . "\n";
        }
        break;
    }
}
