@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | { |
52 | 52 | $suffix = Formats::getFormatExtension(static::FORMAT); |
53 | 53 | if ($suffix === null) { |
54 | - throw new \Exception('Format suffix is empty for ' . static::FORMAT . ', it should be initialized!'); |
|
54 | + throw new \Exception('Format suffix is empty for '.static::FORMAT.', it should be initialized!'); |
|
55 | 55 | } |
56 | 56 | if ($password !== null) { |
57 | - throw new UnsupportedOperationException($suffix . ' archive does not support password!'); |
|
57 | + throw new UnsupportedOperationException($suffix.' archive does not support password!'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | parent::__construct($archiveFileName, $format); |
61 | - $this->inArchiveFileName = basename($archiveFileName, '.' . $suffix); |
|
61 | + $this->inArchiveFileName = basename($archiveFileName, '.'.$suffix); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function extractArchive($outputFolder) |
124 | 124 | { |
125 | - if(method_exists($this, 'streamToFile')){ |
|
125 | + if (method_exists($this, 'streamToFile')) { |
|
126 | 126 | $this->streamToFile($outputFolder.$this->inArchiveFileName); |
127 | - }else{ |
|
127 | + } else { |
|
128 | 128 | $data = $this->getFileContent($this->inArchiveFileName); |
129 | 129 | if ($data === false) |
130 | 130 | throw new ArchiveExtractionException('Could not extract archive'); |
@@ -124,10 +124,11 @@ |
||
124 | 124 | { |
125 | 125 | if(method_exists($this, 'streamToFile')){ |
126 | 126 | $this->streamToFile($outputFolder.$this->inArchiveFileName); |
127 | - }else{ |
|
127 | + } else{ |
|
128 | 128 | $data = $this->getFileContent($this->inArchiveFileName); |
129 | - if ($data === false) |
|
130 | - throw new ArchiveExtractionException('Could not extract archive'); |
|
129 | + if ($data === false) { |
|
130 | + throw new ArchiveExtractionException('Could not extract archive'); |
|
131 | + } |
|
131 | 132 | |
132 | 133 | $size = strlen($data); |
133 | 134 | $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $fp = fopen($file, 'rb'); |
28 | 28 | if (filesize($file) < 18 || strcmp(fread($fp, 2), "\x1f\x8b")) { |
29 | - return false; // Not GZIP format (See RFC 1952) |
|
29 | + return false; // Not GZIP format (See RFC 1952) |
|
30 | 30 | } |
31 | 31 | $method = fread($fp, 1); |
32 | 32 | $flags = fread($fp, 1); |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $fp = fopen($targetPath, "w"); |
99 | 99 | while (!gzeof($sfp)) { |
100 | 100 | $chunk = gzread($sfp, 8192); |
101 | - if($chunk === 0 || $chunk === false) |
|
101 | + if ($chunk === 0 || $chunk === false) |
|
102 | 102 | throw new ArchiveExtractionException('Cannot read gzip chunk'); |
103 | - if(fwrite($fp, $chunk, strlen($chunk)) === false) |
|
103 | + if (fwrite($fp, $chunk, strlen($chunk)) === false) |
|
104 | 104 | throw new ArchiveExtractionException('Cannot write gzip chunk'); |
105 | 105 | } |
106 | 106 | gzclose($sfp); |
@@ -98,10 +98,12 @@ |
||
98 | 98 | $fp = fopen($targetPath, "w"); |
99 | 99 | while (!gzeof($sfp)) { |
100 | 100 | $chunk = gzread($sfp, 8192); |
101 | - if($chunk === 0 || $chunk === false) |
|
102 | - throw new ArchiveExtractionException('Cannot read gzip chunk'); |
|
103 | - if(fwrite($fp, $chunk, strlen($chunk)) === false) |
|
104 | - throw new ArchiveExtractionException('Cannot write gzip chunk'); |
|
101 | + if($chunk === 0 || $chunk === false) { |
|
102 | + throw new ArchiveExtractionException('Cannot read gzip chunk'); |
|
103 | + } |
|
104 | + if(fwrite($fp, $chunk, strlen($chunk)) === false) { |
|
105 | + throw new ArchiveExtractionException('Cannot write gzip chunk'); |
|
106 | + } |
|
105 | 107 | } |
106 | 108 | gzclose($sfp); |
107 | 109 | fclose($fp); |