Completed
Pull Request — develop (#47)
by
unknown
10:56
created
src/PhpSpreadsheet/Reader/BaseReader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
     {
240 240
         // Check if file exists
241 241
         if (!file_exists($pFilename) || !is_readable($pFilename)) {
242
-            throw new Exception('Could not open '.$pFilename.' for reading! File does not exist.');
242
+            throw new Exception('Could not open ' . $pFilename . ' for reading! File does not exist.');
243 243
         }
244 244
 
245 245
         // Open file
246 246
         $this->fileHandle = fopen($pFilename, 'r');
247 247
         if ($this->fileHandle === false) {
248
-            throw new Exception('Could not open file '.$pFilename.' for reading.');
248
+            throw new Exception('Could not open file ' . $pFilename . ' for reading.');
249 249
         }
250 250
     }
251 251
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function securityScan($xml)
260 260
     {
261
-        $pattern = '/\\0?'.implode('\\0?', str_split('<!DOCTYPE')).'\\0?/';
261
+        $pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
262 262
         if (preg_match($pattern, $xml)) {
263 263
             throw new Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
264 264
         }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Reader/SYLK.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         // Open file
133 133
         if (!$this->canRead($pFilename)) {
134
-            throw new Exception($pFilename.' is an Invalid Spreadsheet file.');
134
+            throw new Exception($pFilename . ' is an Invalid Spreadsheet file.');
135 135
         }
136 136
         $this->openFile($pFilename);
137 137
         $fileHandle = $this->fileHandle;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         // Open file
223 223
         if (!$this->canRead($pFilename)) {
224
-            throw new Exception($pFilename.' is an Invalid Spreadsheet file.');
224
+            throw new Exception($pFilename . ' is an Invalid Spreadsheet file.');
225 225
         }
226 226
         $this->openFile($pFilename);
227 227
         $fileHandle = $this->fileHandle;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                             break;
293 293
                     }
294 294
                 }
295
-                $this->formats['P'.$this->format++] = $formatArray;
295
+                $this->formats['P' . $this->format++] = $formatArray;
296 296
             //    Read cell value data
297 297
             } elseif ($dataType == 'C') {
298 298
                 $hasCalculatedValue = false;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                             $cellData = substr($rowDatum, 1);
312 312
                             break;
313 313
                         case 'E':
314
-                            $cellDataFormula = '='.substr($rowDatum, 1);
314
+                            $cellDataFormula = '=' . substr($rowDatum, 1);
315 315
                             //    Convert R1C1 style references to A1 style references (but only when not quoted)
316 316
                             $temp = explode('"', $cellDataFormula);
317 317
                             $key = false;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                                         if ($columnReference{0} == '[') {
345 345
                                             $columnReference = $column + trim($columnReference, '[]');
346 346
                                         }
347
-                                        $A1CellReference = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1).$rowReference;
347
+                                        $A1CellReference = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference;
348 348
 
349 349
                                         $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
350 350
                                     }
@@ -361,10 +361,10 @@  discard block
 block discarded – undo
361 361
                 $cellData = \PhpOffice\PhpSpreadsheet\Calculation::unwrapResult($cellData);
362 362
 
363 363
                 // Set cell value
364
-                $spreadsheet->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
364
+                $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
365 365
                 if ($hasCalculatedValue) {
366 366
                     $cellData = \PhpOffice\PhpSpreadsheet\Calculation::unwrapResult($cellData);
367
-                    $spreadsheet->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
367
+                    $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setCalculatedValue($cellData);
368 368
                 }
369 369
             //    Read cell formatting
370 370
             } elseif ($dataType == 'F') {
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
                 if (($formatStyle > '') && ($column > '') && ($row > '')) {
417 417
                     $columnLetter = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1);
418 418
                     if (isset($this->formats[$formatStyle])) {
419
-                        $spreadsheet->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
419
+                        $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($this->formats[$formatStyle]);
420 420
                     }
421 421
                 }
422 422
                 if ((!empty($styleData)) && ($column > '') && ($row > '')) {
423 423
                     $columnLetter = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1);
424
-                    $spreadsheet->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
424
+                    $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($styleData);
425 425
                 }
426 426
                 if ($columnWidth > '') {
427 427
                     if ($startCol == $endCol) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Reader/Xls/Escher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         $endOffsetY = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($recordData, 16);
594 594
 
595 595
         // set the start coordinates
596
-        $this->object->setStartCoordinates(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($c1).($r1 + 1));
596
+        $this->object->setStartCoordinates(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($c1) . ($r1 + 1));
597 597
 
598 598
         // set the start offsetX
599 599
         $this->object->setStartOffsetX($startOffsetX);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         $this->object->setStartOffsetY($startOffsetY);
603 603
 
604 604
         // set the end coordinates
605
-        $this->object->setEndCoordinates(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($c2).($r2 + 1));
605
+        $this->object->setEndCoordinates(\PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($c2) . ($r2 + 1));
606 606
 
607 607
         // set the end offsetX
608 608
         $this->object->setEndOffsetX($endOffsetX);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Reader/Ods.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         // Check if file exists
61 61
         if (!file_exists($pFilename)) {
62
-            throw new Exception('Could not open '.$pFilename.' for reading! File does not exist.');
62
+            throw new Exception('Could not open ' . $pFilename . ' for reading! File does not exist.');
63 63
         }
64 64
 
65 65
         $zipClass = \PhpOffice\PhpSpreadsheet\Settings::getZipClass();
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
     {
116 116
         // Check if file exists
117 117
         if (!file_exists($pFilename)) {
118
-            throw new Exception('Could not open '.$pFilename.' for reading! File does not exist.');
118
+            throw new Exception('Could not open ' . $pFilename . ' for reading! File does not exist.');
119 119
         }
120 120
 
121 121
         $zipClass = \PhpOffice\PhpSpreadsheet\Settings::getZipClass();
122 122
 
123 123
         $zip = new $zipClass();
124 124
         if (!$zip->open($pFilename)) {
125
-            throw new Exception('Could not open '.$pFilename.' for reading! Error opening file.');
125
+            throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.');
126 126
         }
127 127
 
128 128
         $worksheetNames = [];
129 129
 
130 130
         $xml = new XMLReader();
131 131
         $res = $xml->xml(
132
-            $this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'),
132
+            $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'),
133 133
             null,
134 134
             \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions()
135 135
         );
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     {
173 173
         // Check if file exists
174 174
         if (!file_exists($pFilename)) {
175
-            throw new Exception('Could not open '.$pFilename.' for reading! File does not exist.');
175
+            throw new Exception('Could not open ' . $pFilename . ' for reading! File does not exist.');
176 176
         }
177 177
 
178 178
         $worksheetInfo = [];
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 
182 182
         $zip = new $zipClass();
183 183
         if (!$zip->open($pFilename)) {
184
-            throw new Exception('Could not open '.$pFilename.' for reading! Error opening file.');
184
+            throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.');
185 185
         }
186 186
 
187 187
         $xml = new XMLReader();
188 188
         $res = $xml->xml(
189
-            $this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'),
189
+            $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'),
190 190
             null,
191 191
             \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions()
192 192
         );
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         // Check if file exists
304 304
         if (!file_exists($pFilename)) {
305
-            throw new Exception('Could not open '.$pFilename.' for reading! File does not exist.');
305
+            throw new Exception('Could not open ' . $pFilename . ' for reading! File does not exist.');
306 306
         }
307 307
 
308 308
         $timezoneObj = new DateTimeZone('Europe/London');
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
         $zip = new $zipClass();
314 314
         if (!$zip->open($pFilename)) {
315
-            throw new Exception('Could not open '.$pFilename.' for reading! Error opening file.');
315
+            throw new Exception('Could not open ' . $pFilename . ' for reading! Error opening file.');
316 316
         }
317 317
 
318 318
         $xml = simplexml_load_string(
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                                         }
477 477
                                     }
478 478
                                     $text = implode("\n", $textArray);
479
-                                    $spreadsheet->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text));
479
+                                    $spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setText($this->parseRichText($text));
480 480
 //                                                                    ->setAuthor( $author )
481 481
                                 }
482 482
 
@@ -552,14 +552,14 @@  discard block
 block discarded – undo
552 552
                                             list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
553 553
                                             $dataValue = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
554 554
                                             if ($dataValue != floor($dataValue)) {
555
-                                                $formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15.' '.\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4;
555
+                                                $formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15 . ' ' . \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4;
556 556
                                             } else {
557 557
                                                 $formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15;
558 558
                                             }
559 559
                                             break;
560 560
                                         case 'time':
561 561
                                             $type = \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC;
562
-                                            $dataValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
562
+                                            $dataValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(strtotime('01-01-1970 ' . implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
563 563
                                             $formatting = \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4;
564 564
                                             break;
565 565
                                     }
@@ -597,17 +597,17 @@  discard block
 block discarded – undo
597 597
                                         if ($type !== \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NULL) {
598 598
                                             for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
599 599
                                                 $rID = $rowID + $rowAdjust;
600
-                                                $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
600
+                                                $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
601 601
                                                 if ($hasCalculatedValue) {
602
-                                                    $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue);
602
+                                                    $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setCalculatedValue($dataValue);
603 603
                                                 }
604 604
                                                 if ($formatting !== null) {
605
-                                                    $spreadsheet->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
605
+                                                    $spreadsheet->getActiveSheet()->getStyle($columnID . $rID)->getNumberFormat()->setFormatCode($formatting);
606 606
                                                 } else {
607
-                                                    $spreadsheet->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_GENERAL);
607
+                                                    $spreadsheet->getActiveSheet()->getStyle($columnID . $rID)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_GENERAL);
608 608
                                                 }
609 609
                                                 if ($hyperlink !== null) {
610
-                                                    $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
610
+                                                    $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->getHyperlink()->setUrl($hyperlink);
611 611
                                                 }
612 612
                                             }
613 613
                                         }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
                                         if (isset($cellDataTableAttributes['number-rows-spanned'])) {
626 626
                                             $rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1;
627 627
                                         }
628
-                                        $cellRange = $columnID.$rowID.':'.$columnTo.$rowTo;
628
+                                        $cellRange = $columnID . $rowID . ':' . $columnTo . $rowTo;
629 629
                                         $spreadsheet->getActiveSheet()->mergeCells($cellRange);
630 630
                                     }
631 631
                                 }
Please login to merge, or discard this patch.
src/Bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,6 +26,6 @@
 block discarded – undo
26 26
  *
27 27
  * @version    ##VERSION##, ##DATE##
28 28
  */
29
-include_once __DIR__.'/Autoloader.php';
29
+include_once __DIR__ . '/Autoloader.php';
30 30
 
31 31
 \PhpOffice\PhpSpreadsheet\Autoloader::register();
Please login to merge, or discard this patch.
src/Autoloader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@
 block discarded – undo
56 56
             return false;
57 57
         }
58 58
 
59
-        $classFilePath = __DIR__.DIRECTORY_SEPARATOR.
60
-            'PhpSpreadsheet'.DIRECTORY_SEPARATOR.
61
-            str_replace([$prefix, '\\'], ['', '/'], $className).
59
+        $classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
60
+            'PhpSpreadsheet' . DIRECTORY_SEPARATOR .
61
+            str_replace([$prefix, '\\'], ['', '/'], $className) .
62 62
             '.php';
63 63
 
64 64
         if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {
Please login to merge, or discard this patch.