Skip to content

Commit

Permalink
Fix class names for compression streams
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 24, 2024
1 parent 875d97f commit 34a718a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/php/xp/frontend/Bundle.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php namespace xp\frontend;

use io\File;
use io\streams\{GzCompressingOutputStream, OutputStream};
use io\streams\OutputStream;
use io\streams\compress\{GzipOutputStream, BrotliOutputStream};

class Bundle implements OutputStream {
const COMPRESS = ['css', 'js', 'svg', 'json', 'xml', 'ttf', 'otf', 'eot'];
Expand All @@ -27,8 +28,8 @@ public function __construct($path, $type= null) {
// Check whether it's typically worthwhile compressing a file based on the
// given type (falling back to the file extension if omitted).
if (in_array($type ?? strtolower(substr($path, strrpos($path, '.') + 1)), self::COMPRESS)) {
self::$zlib && $this->output[]= new GzCompressingOutputStream($this->output($path, '.gz'), 9);
self::$brotli && $this->output[]= new BrCompressingOutputStream($this->output($path, '.br'), 11);
self::$zlib && $this->output[]= new GzipOutputStream($this->output($path, '.gz'), 9);
self::$brotli && $this->output[]= new BrotliOutputStream($this->output($path, '.br'), 11);
}
}

Expand Down

0 comments on commit 34a718a

Please sign in to comment.