<commit_before><?php

namespace Services;

class QrCodeWriter implements TicketPartWriterInterface {
    private $writer;
    private $outputDirectoryPath;

    public function __construct(\BaconQrCode\Writer $writer, $outputDirectoryPath) {
        $this->writer = $writer;
        $this->outputDirectoryPath = $outputDirectoryPath;
    }

    public function write(ExpandedReservationInterface $reservation, array $partFilePaths, $printOrderId, $locale) {
        $filePath = $this->outputDirectoryPath . '/' . $reservation->unique_id . '_qr.png';
        $this->writer->writeFile($reservation->unique_id, $filePath);

        $partFilePaths['qr'] = $filePath;
        return $partFilePaths;
    }
}<commit_msg>Embed QR code as Data URL<commit_after><?php

namespace Services;

class QrCodeWriter implements TicketPartWriterInterface {
    private $writer;
    private $outputDirectoryPath;

    public function __construct(\BaconQrCode\Writer $writer, $outputDirectoryPath) {
        $this->writer = $writer;
        $this->outputDirectoryPath = $outputDirectoryPath;
    }

    public function write(ExpandedReservationInterface $reservation, array $partFilePaths, $printOrderId, $locale) {
        $dataUrl = 'data:image/png;base64,' . base64_encode($this->writer->writeString($reservation->unique_id));

        $partFilePaths['qr'] = $dataUrl;
        return $partFilePaths;
    }
}
{'fraction_non_alphanumeric': 0.11591072714182865, 'fraction_numerical': 0.0028797696184305254, 'mean_word_length': 4.129151291512915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1847308', 'n_tokens_mistral': 403, 'n_tokens_neox': 390, 'n_words': 78}