| | $result = $this->handleRefDelta( $handle, $size, $cap ); |
| | } else { |
| | - $result = $this->decompressToString( $handle, $cap ); |
| | + $result = $this->inflate( $handle, $cap ); |
| | } |
| | |
 |
| | } |
| | |
| | - private function decompressToString( |
| | - $handle, |
| | - int $cap = 0 |
| | - ): string { |
| | + private function inflate( $handle, int $cap = 0 ): string { |
| | $stream = CompressionStream::createInflater(); |
| | - $res = ''; |
| | + $result = ''; |
| | |
| | foreach( $stream->stream( $handle ) as $data ) { |
| | - $res .= $data; |
| | + $result .= $data; |
| | |
| | - if( $cap > 0 && strlen( $res ) >= $cap ) { |
| | - $res = substr( $res, 0, $cap ); |
| | + if( $cap > 0 && strlen( $result ) >= $cap ) { |
| | + $result = substr( $result, 0, $cap ); |
| | |
| | break; |
| | } |
| | } |
| | |
| | - return $res; |
| | + return $result; |
| | } |
| | |