@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | public function removeTag(DOMElement $tag) : void |
162 | 162 | { |
163 | - if(isset($tag->parentNode)) |
|
163 | + if (isset($tag->parentNode)) |
|
164 | 164 | { |
165 | 165 | $tag->parentNode->removeChild($tag); |
166 | 166 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | if (!empty($text)) { |
250 | 250 | $fragment = $this->dom->createDocumentFragment(); |
251 | - if(!@$fragment->appendXML($text)) { |
|
251 | + if (!@$fragment->appendXML($text)) { |
|
252 | 252 | throw new XMLHelper_Exception( |
253 | 253 | 'Cannot append XML fragment', |
254 | 254 | sprintf( |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @return DOMNode |
293 | 293 | * @throws DOMException |
294 | 294 | */ |
295 | - public function createRoot(string $name, array $attributes=array()) : DOMNode |
|
295 | + public function createRoot(string $name, array $attributes = array()) : DOMNode |
|
296 | 296 | { |
297 | 297 | $root = $this->dom->appendChild($this->dom->createElement($name)); |
298 | 298 | $this->addAttributes($root, $attributes); |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public static function downloadXML(string $xml, string $filename = 'download.xml') : void |
347 | 347 | { |
348 | - if(!self::$simulation && !headers_sent()) |
|
348 | + if (!self::$simulation && !headers_sent()) |
|
349 | 349 | { |
350 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
350 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | echo $xml; |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function displayXML(string $xml) : void |
363 | 363 | { |
364 | - if(!self::$simulation && !headers_sent()) |
|
364 | + if (!self::$simulation && !headers_sent()) |
|
365 | 365 | { |
366 | 366 | header('Content-Type:text/xml; charset=utf-8'); |
367 | 367 | } |
368 | 368 | |
369 | - if(self::$simulation) |
|
369 | + if (self::$simulation) |
|
370 | 370 | { |
371 | 371 | $xml = '<pre>'.htmlspecialchars($xml).'</pre>'; |
372 | 372 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @throws DOMException |
386 | 386 | * @see buildErrorXML() |
387 | 387 | */ |
388 | - public static function displayErrorXML($code, string $message, string $title, array $customInfo=array()) : void |
|
388 | + public static function displayErrorXML($code, string $message, string $title, array $customInfo = array()) : void |
|
389 | 389 | { |
390 | - if(!self::$simulation && !headers_sent()) { |
|
391 | - header('HTTP/1.1 400 Bad Request: ' . $title, true, 400); |
|
390 | + if (!self::$simulation && !headers_sent()) { |
|
391 | + header('HTTP/1.1 400 Bad Request: '.$title, true, 400); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo)); |
395 | 395 | } |
396 | 396 | |
397 | - public static function setSimulation(bool $simulate=true) : void |
|
397 | + public static function setSimulation(bool $simulate = true) : void |
|
398 | 398 | { |
399 | 399 | self::$simulation = $simulate; |
400 | 400 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return string |
446 | 446 | * @throws DOMException |
447 | 447 | */ |
448 | - public static function buildErrorXML($code, string $message, string $title, array $customInfo=array()) : string |
|
448 | + public static function buildErrorXML($code, string $message, string $title, array $customInfo = array()) : string |
|
449 | 449 | { |
450 | 450 | $xml = new DOMDocument('1.0', 'UTF-8'); |
451 | 451 | $xml->formatOutput = true; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | $helper->addTextTag($root, 'title', $title); |
460 | 460 | $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']); |
461 | 461 | |
462 | - foreach($customInfo as $name => $value) { |
|
462 | + foreach ($customInfo as $name => $value) { |
|
463 | 463 | $helper->addTextTag($root, $name, $value); |
464 | 464 | } |
465 | 465 |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | $lines[] = '--'.$this->boundaries->getMimeBoundary(); |
114 | 114 | $lines[] = $this->renderContentDisposition(); |
115 | 115 | |
116 | - if(!empty($this->contentType)) |
|
116 | + if (!empty($this->contentType)) |
|
117 | 117 | { |
118 | 118 | $lines[] = $this->renderContentType(); |
119 | 119 | } |
120 | 120 | |
121 | - if(!empty($this->transferEncoding)) |
|
121 | + if (!empty($this->transferEncoding)) |
|
122 | 122 | { |
123 | 123 | $lines[] = $this->renderTransferEncoding(); |
124 | 124 | } |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | { |
134 | 134 | $result = 'Content-Disposition: form-data'; |
135 | 135 | |
136 | - foreach($this->dispositionParams as $name => $value) |
|
136 | + foreach ($this->dispositionParams as $name => $value) |
|
137 | 137 | { |
138 | - $result .= '; '.$name.'="' . $value . '"'; |
|
138 | + $result .= '; '.$name.'="'.$value.'"'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $result; |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | |
144 | 144 | protected function renderContentType() : string |
145 | 145 | { |
146 | - $result = 'Content-Type: ' . $this->contentType; |
|
146 | + $result = 'Content-Type: '.$this->contentType; |
|
147 | 147 | |
148 | - if(!empty($this->contentEncoding)) |
|
148 | + if (!empty($this->contentEncoding)) |
|
149 | 149 | { |
150 | - $result .= '; charset="' . $this->contentEncoding.'"'; |
|
150 | + $result .= '; charset="'.$this->contentEncoding.'"'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return $result; |
@@ -155,6 +155,6 @@ discard block |
||
155 | 155 | |
156 | 156 | protected function renderTransferEncoding() : string |
157 | 157 | { |
158 | - return 'Content-Transfer-Encoding: ' . $this->transferEncoding; |
|
158 | + return 'Content-Transfer-Encoding: '.$this->transferEncoding; |
|
159 | 159 | } |
160 | 160 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param array<mixed>|null $serialized |
68 | 68 | * @throws BaseException |
69 | 69 | */ |
70 | - public function __construct($value, ?array $serialized=null) |
|
70 | + public function __construct($value, ?array $serialized = null) |
|
71 | 71 | { |
72 | - if(is_array($serialized)) |
|
72 | + if (is_array($serialized)) |
|
73 | 73 | { |
74 | 74 | $this->parseSerialized($serialized); |
75 | 75 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function parseSerialized(array $serialized) : void |
119 | 119 | { |
120 | - if(!isset($serialized['string'], $serialized['type'], $serialized['options'])) |
|
120 | + if (!isset($serialized['string'], $serialized['type'], $serialized['options'])) |
|
121 | 121 | { |
122 | 122 | throw new BaseException( |
123 | 123 | 'Invalid variable info serialized data.', |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | |
144 | 144 | // Gettype will return a string like "Resource(closed)" when |
145 | 145 | // working with a resource that has already been closed. |
146 | - if(stripos($this->type, 'resource') !== false) |
|
146 | + if (stripos($this->type, 'resource') !== false) |
|
147 | 147 | { |
148 | 148 | $this->type = self::TYPE_RESOURCE; |
149 | 149 | } |
150 | 150 | |
151 | - if(is_callable($value) && in_array($this->type, $this->callableTypes)) { |
|
151 | + if (is_callable($value) && in_array($this->type, $this->callableTypes)) { |
|
152 | 152 | $this->type = self::TYPE_CALLABLE; |
153 | 153 | } |
154 | 154 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param bool $enable |
193 | 193 | * @return VariableInfo |
194 | 194 | */ |
195 | - public function enableType(bool $enable=true) : VariableInfo |
|
195 | + public function enableType(bool $enable = true) : VariableInfo |
|
196 | 196 | { |
197 | 197 | return $this->setOption('prepend-type', $enable); |
198 | 198 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | { |
202 | 202 | $converted = $this->string; |
203 | 203 | |
204 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
204 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
205 | 205 | { |
206 | - if($this->isString()) |
|
206 | + if ($this->isString()) |
|
207 | 207 | { |
208 | 208 | $converted = '"'.$converted.'"'; |
209 | 209 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->traverseChildren(); |
97 | 97 | $this->encodeTextElements(); |
98 | 98 | |
99 | - if(is_array($this->result) && !empty($this->result)) |
|
99 | + if (is_array($this->result) && !empty($this->result)) |
|
100 | 100 | { |
101 | 101 | return $this->result; |
102 | 102 | } |
@@ -107,20 +107,20 @@ discard block |
||
107 | 107 | |
108 | 108 | protected function detectAttributes() : void |
109 | 109 | { |
110 | - if(!$this->options['@attributes']) { |
|
110 | + if (!$this->options['@attributes']) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | 114 | $attributes = $this->subject->attributes(); |
115 | 115 | |
116 | - if($attributes === null) |
|
116 | + if ($attributes === null) |
|
117 | 117 | { |
118 | 118 | return; |
119 | 119 | } |
120 | 120 | |
121 | 121 | $values = array_map('strval', iterator_to_array($attributes)); |
122 | 122 | |
123 | - if(!empty($values)) |
|
123 | + if (!empty($values)) |
|
124 | 124 | { |
125 | 125 | $this->result['@attributes'] = $values; |
126 | 126 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $children = $this->subject; |
132 | 132 | $depth = $this->options['depth'] - 1; |
133 | 133 | |
134 | - if($depth <= 0) |
|
134 | + if ($depth <= 0) |
|
135 | 135 | { |
136 | 136 | $children = []; |
137 | 137 | } |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | |
145 | 145 | $decorator->options = ['depth' => $depth] + $this->options; |
146 | 146 | |
147 | - if(isset($this->result[$name])) |
|
147 | + if (isset($this->result[$name])) |
|
148 | 148 | { |
149 | - if(!is_array($this->result[$name])) |
|
149 | + if (!is_array($this->result[$name])) |
|
150 | 150 | { |
151 | 151 | $this->result[$name] = array($this->result[$name]); |
152 | 152 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | // json encode non-whitespace element simplexml text values. |
166 | 166 | $text = trim((string)$this->subject); |
167 | 167 | |
168 | - if($text !== '') |
|
168 | + if ($text !== '') |
|
169 | 169 | { |
170 | - if($this->options['@text']) |
|
170 | + if ($this->options['@text']) |
|
171 | 171 | { |
172 | 172 | $this->result['@text'] = $text; |
173 | 173 | } |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct(array $libxmlErrors) |
37 | 37 | { |
38 | - foreach($libxmlErrors as $error) |
|
38 | + foreach ($libxmlErrors as $error) |
|
39 | 39 | { |
40 | - if($error instanceof XMLHelper_DOMErrors_Error) |
|
40 | + if ($error instanceof XMLHelper_DOMErrors_Error) |
|
41 | 41 | { |
42 | 42 | $this->errors[] = $error; |
43 | 43 | } |
44 | - else if($error instanceof LibXMLError) |
|
44 | + else if ($error instanceof LibXMLError) |
|
45 | 45 | { |
46 | 46 | $this->errors[] = new XMLHelper_DOMErrors_Error($error); |
47 | 47 | } |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $result = array(); |
133 | 133 | |
134 | - foreach($this->errors as $error) |
|
134 | + foreach ($this->errors as $error) |
|
135 | 135 | { |
136 | - if($error->isLevel($level)) |
|
136 | + if ($error->isLevel($level)) |
|
137 | 137 | { |
138 | 138 | $result[] = $error; |
139 | 139 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | { |
153 | 153 | $result = array(); |
154 | 154 | |
155 | - foreach($this->errors as $error) |
|
155 | + foreach ($this->errors as $error) |
|
156 | 156 | { |
157 | - if($error->isCode($code)) |
|
157 | + if ($error->isCode($code)) |
|
158 | 158 | { |
159 | 159 | $result[] = $error; |
160 | 160 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function hasErrorsByLevel(int $level) : bool |
173 | 173 | { |
174 | - foreach($this->errors as $error) |
|
174 | + foreach ($this->errors as $error) |
|
175 | 175 | { |
176 | - if($error->isLevel($level)) |
|
176 | + if ($error->isLevel($level)) |
|
177 | 177 | { |
178 | 178 | return true; |
179 | 179 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function hasErrorsByCode(int $code) : bool |
192 | 192 | { |
193 | - foreach($this->errors as $error) |
|
193 | + foreach ($this->errors as $error) |
|
194 | 194 | { |
195 | - if($error->isCode($code)) |
|
195 | + if ($error->isCode($code)) |
|
196 | 196 | { |
197 | 197 | return true; |
198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | { |
209 | 209 | $result = array(); |
210 | 210 | |
211 | - foreach($this->errors as $error) |
|
211 | + foreach ($this->errors as $error) |
|
212 | 212 | { |
213 | 213 | $result[] = $error->toArray(); |
214 | 214 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $data = array(); |
229 | 229 | |
230 | - foreach($this->errors as $error) |
|
230 | + foreach ($this->errors as $error) |
|
231 | 231 | { |
232 | 232 | $data[] = $error->serialize(); |
233 | 233 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $parts = explode(self::SERIALIZE_SEPARATOR, $serialized); |
250 | 250 | $list = array(); |
251 | 251 | |
252 | - foreach($parts as $part) |
|
252 | + foreach ($parts as $part) |
|
253 | 253 | { |
254 | 254 | $list[] = XMLHelper_DOMErrors_Error::fromSerialized($part); |
255 | 255 | } |
@@ -90,9 +90,9 @@ |
||
90 | 90 | */ |
91 | 91 | private static function checkErrorData(array $data) : void |
92 | 92 | { |
93 | - foreach(self::$requiredKeys as $key) |
|
93 | + foreach (self::$requiredKeys as $key) |
|
94 | 94 | { |
95 | - if(!array_key_exists($key, $data)) |
|
95 | + if (!array_key_exists($key, $data)) |
|
96 | 96 | { |
97 | 97 | throw new XMLHelper_Exception( |
98 | 98 | 'Required key missing in error data', |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // error wrappers. |
84 | 84 | $errors = libxml_get_errors(); |
85 | 85 | |
86 | - foreach($errors as $error) |
|
86 | + foreach ($errors as $error) |
|
87 | 87 | { |
88 | 88 | $this->errors[] = new XMLHelper_SimpleXML_Error($this, $error); |
89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $xml = $function($subject); |
99 | 99 | |
100 | - if($xml instanceof SimpleXMLElement) |
|
100 | + if ($xml instanceof SimpleXMLElement) |
|
101 | 101 | { |
102 | 102 | return $xml; |
103 | 103 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function getConverter() : XMLHelper_Converter |
109 | 109 | { |
110 | - if($this->element instanceof SimpleXMLElement) |
|
110 | + if ($this->element instanceof SimpleXMLElement) |
|
111 | 111 | { |
112 | 112 | return XMLHelper::convertElement($this->element); |
113 | 113 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | $output = curl_exec($ch); |
207 | 207 | |
208 | - if(isset($this->logfilePointer)) |
|
208 | + if (isset($this->logfilePointer)) |
|
209 | 209 | { |
210 | 210 | fclose($this->logfilePointer); |
211 | 211 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | // CURL will complain about an empty response when the |
218 | 218 | // server sends a 100-continue code. That should not be |
219 | 219 | // regarded as an error. |
220 | - if($output === false && $this->response->getCode() !== 100) |
|
220 | + if ($output === false && $this->response->getCode() !== 100) |
|
221 | 221 | { |
222 | 222 | $curlCode = curl_errno($ch); |
223 | 223 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | { |
261 | 261 | $ch = curl_init(); |
262 | 262 | |
263 | - if(!is_resource($ch)) |
|
263 | + if (!is_resource($ch)) |
|
264 | 264 | { |
265 | 265 | throw new RequestHelper_Exception( |
266 | 266 | 'Could not initialize a new cURL instance.', |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | $this->setHeader('Content-Length', (string)$this->boundaries->getContentLength()); |
273 | - $this->setHeader('Content-Type', 'multipart/form-data; boundary=' . $this->mimeBoundary); |
|
273 | + $this->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->mimeBoundary); |
|
274 | 274 | |
275 | 275 | curl_setopt($ch, CURLOPT_POST, true); |
276 | 276 | curl_setopt($ch, CURLOPT_URL, $url->getNormalizedWithoutAuth()); |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | |
284 | 284 | $loggingEnabled = $this->configureLogging($ch); |
285 | 285 | |
286 | - if(!$loggingEnabled) |
|
286 | + if (!$loggingEnabled) |
|
287 | 287 | { |
288 | 288 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
289 | 289 | } |
290 | 290 | |
291 | - if($this->verifySSL) |
|
291 | + if ($this->verifySSL) |
|
292 | 292 | { |
293 | 293 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
294 | 294 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
295 | 295 | } |
296 | 296 | |
297 | - if($url->hasUsername()) |
|
297 | + if ($url->hasUsername()) |
|
298 | 298 | { |
299 | 299 | curl_setopt($ch, CURLOPT_USERNAME, $url->getUsername()); |
300 | 300 | curl_setopt($ch, CURLOPT_PASSWORD, $url->getPassword()); |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function configureLogging($ch) : bool |
312 | 312 | { |
313 | - if(empty($this->logfile)) |
|
313 | + if (empty($this->logfile)) |
|
314 | 314 | { |
315 | 315 | return false; |
316 | 316 | } |
317 | 317 | |
318 | 318 | $res = fopen($this->logfile, 'wb+'); |
319 | 319 | |
320 | - if($res === false) |
|
320 | + if ($res === false) |
|
321 | 321 | { |
322 | 322 | throw new RequestHelper_Exception( |
323 | 323 | 'Cannot open logfile for writing.', |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | $this->setHeader('Expect', ''); |
349 | 349 | |
350 | - foreach($this->headers as $name => $value) { |
|
350 | + foreach ($this->headers as $name => $value) { |
|
351 | 351 | $result[] = $name.': '.$value; |
352 | 352 | } |
353 | 353 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | { |
365 | 365 | $response = $this->getResponse(); |
366 | 366 | |
367 | - if($response !== null) { |
|
367 | + if ($response !== null) { |
|
368 | 368 | return $response->getHeaders(); |
369 | 369 | } |
370 | 370 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public const ERROR_OPENING_ZIP_FILE = 338003; |
34 | 34 | |
35 | - public const ERROR_CANNOT_SAVE_FILE_TO_DISK =338004; |
|
35 | + public const ERROR_CANNOT_SAVE_FILE_TO_DISK = 338004; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @var array<string,mixed> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST |
87 | 87 | */ |
88 | - public function addFile(string $filePath, ?string $zipPath=null) : bool |
|
88 | + public function addFile(string $filePath, ?string $zipPath = null) : bool |
|
89 | 89 | { |
90 | 90 | $this->open(); |
91 | 91 | |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function open() : void |
140 | 140 | { |
141 | - if($this->open) { |
|
141 | + if ($this->open) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - if(!isset($this->zip)) { |
|
145 | + if (!isset($this->zip)) { |
|
146 | 146 | $this->zip = new ZipArchive(); |
147 | 147 | } |
148 | 148 | |
149 | 149 | $flag = null; |
150 | - if(!file_exists($this->file)) { |
|
150 | + if (!file_exists($this->file)) { |
|
151 | 151 | $flag = ZipArchive::CREATE; |
152 | 152 | } |
153 | 153 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | $this->fileTracker++; |
192 | 192 | |
193 | - if($this->options['WriteThreshold'] < 1) { |
|
193 | + if ($this->options['WriteThreshold'] < 1) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | 196 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | protected function close() : void |
205 | 205 | { |
206 | - if(!$this->open) { |
|
206 | + if (!$this->open) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | throw new ZIPHelper_Exception( |
213 | 213 | 'Could not save ZIP file to disk', |
214 | 214 | sprintf( |
215 | - 'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, ' . |
|
216 | - 'including adding files that do not exist on disk, trying to create an empty zip, ' . |
|
215 | + 'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, '. |
|
216 | + 'including adding files that do not exist on disk, trying to create an empty zip, '. |
|
217 | 217 | 'or trying to save to a directory that does not exist.', |
218 | 218 | $this->file |
219 | 219 | ), |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | { |
229 | 229 | $this->open(); |
230 | 230 | |
231 | - if($this->countFiles() < 1) |
|
231 | + if ($this->countFiles() < 1) |
|
232 | 232 | { |
233 | 233 | throw new ZIPHelper_Exception( |
234 | 234 | 'No files in the zip file', |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | * @throws ZIPHelper_Exception |
255 | 255 | * @return string The file name that was sent (useful in case none was specified). |
256 | 256 | */ |
257 | - public function download(?string $fileName=null) : string |
|
257 | + public function download(?string $fileName = null) : string |
|
258 | 258 | { |
259 | 259 | $this->save(); |
260 | 260 | |
261 | - if(empty($fileName)) |
|
261 | + if (empty($fileName)) |
|
262 | 262 | { |
263 | 263 | $fileName = basename($this->file); |
264 | 264 | } |
265 | 265 | |
266 | 266 | header('Content-type: application/zip'); |
267 | - header('Content-Disposition: attachment; filename=' . $fileName); |
|
268 | - header('Content-length: ' . filesize($this->file)); |
|
267 | + header('Content-Disposition: attachment; filename='.$fileName); |
|
268 | + header('Content-length: '.filesize($this->file)); |
|
269 | 269 | header('Pragma: no-cache'); |
270 | 270 | header('Expires: 0'); |
271 | 271 | readfile($this->file); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @throws ZIPHelper_Exception |
284 | 284 | * @see ZIPHelper::download() |
285 | 285 | */ |
286 | - public function downloadAndDelete(?string $fileName=null) : ZIPHelper |
|
286 | + public function downloadAndDelete(?string $fileName = null) : ZIPHelper |
|
287 | 287 | { |
288 | 288 | $this->download($fileName); |
289 | 289 | |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder. |
301 | 301 | * @return boolean |
302 | 302 | */ |
303 | - public function extractAll(?string $outputFolder=null) : bool |
|
303 | + public function extractAll(?string $outputFolder = null) : bool |
|
304 | 304 | { |
305 | - if(empty($outputFolder)) { |
|
305 | + if (empty($outputFolder)) { |
|
306 | 306 | $outputFolder = dirname($this->file); |
307 | 307 | } |
308 | 308 |