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