<?php require_once __DIR__ . '/Page.php'; class RawPage implements Page { private Git $git; private string $hash; public function __construct( Git $git, string $hash ) { $this->git = $git; $this->hash = $hash; } public function render(): void { $name = $_GET['name'] ?? ''; $file = $this->git->readFile( $this->hash, $name ); while( ob_get_level() > 0 ) { if( !ob_end_clean() ) { break; } } $file->emitRawHeaders(); $this->git->stream( $this->hash, function( string $data ): void { echo $data; }, $name ); exit; } }