@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function testGetXMLSettings() |
15 | 15 | { |
16 | - $result = call_user_func(array(\PhpSpreadsheet\Settings::class,'getLibXmlLoaderOptions')); |
|
16 | + $result = call_user_func(array(\PhpSpreadsheet\Settings::class, 'getLibXmlLoaderOptions')); |
|
17 | 17 | $this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result)); |
18 | 18 | } |
19 | 19 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function testSetXMLSettings() |
23 | 23 | { |
24 | - call_user_func_array(array(\PhpSpreadsheet\Settings::class,'setLibXmlLoaderOptions'), [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]); |
|
25 | - $result = call_user_func(array(\PhpSpreadsheet\Settings::class,'getLibXmlLoaderOptions')); |
|
24 | + call_user_func_array(array(\PhpSpreadsheet\Settings::class, 'setLibXmlLoaderOptions'), [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]); |
|
25 | + $result = call_user_func(array(\PhpSpreadsheet\Settings::class, 'getLibXmlLoaderOptions')); |
|
26 | 26 | $this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result)); |
27 | 27 | } |
28 | 28 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @static |
35 | 35 | */ |
36 | 36 | private static $searchLocations = array( |
37 | - array( 'type' => 'IWriter', 'path' => 'PhpSpreadsheet/Writer/{0}.php', 'class' => '\\PhpSpreadsheet\\Writer\\{0}' ), |
|
38 | - array( 'type' => 'IReader', 'path' => 'PhpSpreadsheet/Reader/{0}.php', 'class' => '\\PhpSpreadsheet\\Reader\\{0}' ) |
|
37 | + array('type' => 'IWriter', 'path' => 'PhpSpreadsheet/Writer/{0}.php', 'class' => '\\PhpSpreadsheet\\Writer\\{0}'), |
|
38 | + array('type' => 'IReader', 'path' => 'PhpSpreadsheet/Reader/{0}.php', 'class' => '\\PhpSpreadsheet\\Reader\\{0}') |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function addSearchLocation($type = '', $location = '', $classname = '') |
105 | 105 | { |
106 | - self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname ); |
|
106 | + self::$searchLocations[] = array('type' => $type, 'path' => $location, 'class' => $classname); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | // total byte size of Excel data (workbook global substream + sheet substreams) |
457 | 457 | $this->dataSize = strlen($this->data); |
458 | 458 | |
459 | - $this->pos = 0; |
|
460 | - $this->sheets = array(); |
|
459 | + $this->pos = 0; |
|
460 | + $this->sheets = array(); |
|
461 | 461 | |
462 | 462 | // Parse Workbook Global Substream |
463 | 463 | while ($this->pos < $this->dataSize) { |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | // $range should look like one of these |
1124 | 1124 | // Foo!$C$7:$J$66 |
1125 | 1125 | // Bar!$A$1:$IV$2 |
1126 | - $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
1126 | + $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
1127 | 1127 | $sheetName = trim($explodes[0], "'"); |
1128 | 1128 | if (count($explodes) == 2) { |
1129 | 1129 | if (strpos($explodes[1], ':') === false) { |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | $secLength = self::getInt4d($this->summaryInformation, $secOffset); |
1307 | 1307 | |
1308 | 1308 | // offset: $secOffset+4; size: 4; property count |
1309 | - $countProperties = self::getInt4d($this->summaryInformation, $secOffset+4); |
|
1309 | + $countProperties = self::getInt4d($this->summaryInformation, $secOffset + 4); |
|
1310 | 1310 | |
1311 | 1311 | // initialize code page (used to resolve string values) |
1312 | 1312 | $codePage = 'CP1252'; |
@@ -1315,11 +1315,11 @@ discard block |
||
1315 | 1315 | // loop through property decarations and properties |
1316 | 1316 | for ($i = 0; $i < $countProperties; ++$i) { |
1317 | 1317 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
1318 | - $id = self::getInt4d($this->summaryInformation, ($secOffset+8) + (8 * $i)); |
|
1318 | + $id = self::getInt4d($this->summaryInformation, ($secOffset + 8) + (8 * $i)); |
|
1319 | 1319 | |
1320 | 1320 | // Use value of property id as appropriate |
1321 | 1321 | // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48) |
1322 | - $offset = self::getInt4d($this->summaryInformation, ($secOffset+12) + (8 * $i)); |
|
1322 | + $offset = self::getInt4d($this->summaryInformation, ($secOffset + 12) + (8 * $i)); |
|
1323 | 1323 | |
1324 | 1324 | $type = self::getInt4d($this->summaryInformation, $secOffset + $offset); |
1325 | 1325 | |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | // echo '$secLength = ', $secLength,'<br />'; |
1445 | 1445 | |
1446 | 1446 | // offset: $secOffset+4; size: 4; property count |
1447 | - $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset+4); |
|
1447 | + $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset + 4); |
|
1448 | 1448 | // echo '$countProperties = ', $countProperties,'<br />'; |
1449 | 1449 | |
1450 | 1450 | // initialize code page (used to resolve string values) |
@@ -1455,12 +1455,12 @@ discard block |
||
1455 | 1455 | for ($i = 0; $i < $countProperties; ++$i) { |
1456 | 1456 | // echo 'Property ', $i,'<br />'; |
1457 | 1457 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
1458 | - $id = self::getInt4d($this->documentSummaryInformation, ($secOffset+8) + (8 * $i)); |
|
1458 | + $id = self::getInt4d($this->documentSummaryInformation, ($secOffset + 8) + (8 * $i)); |
|
1459 | 1459 | // echo 'ID is ', $id,'<br />'; |
1460 | 1460 | |
1461 | 1461 | // Use value of property id as appropriate |
1462 | 1462 | // offset: 60 + 8 * $i; size: 4; offset from beginning of section (48) |
1463 | - $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset+12) + (8 * $i)); |
|
1463 | + $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset + 12) + (8 * $i)); |
|
1464 | 1464 | |
1465 | 1465 | $type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset); |
1466 | 1466 | // echo 'Type is ', $type,', '; |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | // Concatenate this extension with the currently set comment for the cell |
1619 | 1619 | $comment = $this->phpSheet->getComment($cellAddress); |
1620 | 1620 | $commentText = $comment->getText()->getPlainText(); |
1621 | - $comment->setText($this->parseRichText($commentText.$noteText)); |
|
1621 | + $comment->setText($this->parseRichText($commentText . $noteText)); |
|
1622 | 1622 | } else { |
1623 | 1623 | // Set comment for the cell |
1624 | 1624 | $this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText)); |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | $text = $this->getSplicedRecordData(); |
1657 | 1657 | |
1658 | 1658 | $this->textObjects[$this->textObjRef] = array( |
1659 | - 'text' => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText), |
|
1659 | + 'text' => substr($text["recordData"], $text["spliceOffsets"][0] + 1, $cchText), |
|
1660 | 1660 | 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), |
1661 | 1661 | 'alignment' => $grbitOpts, |
1662 | 1662 | 'rotation' => $rot |
@@ -2871,7 +2871,7 @@ discard block |
||
2871 | 2871 | ++$pos; |
2872 | 2872 | |
2873 | 2873 | // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed |
2874 | - $isCompressed = (($optionFlags & 0x01) == 0) ; |
|
2874 | + $isCompressed = (($optionFlags & 0x01) == 0); |
|
2875 | 2875 | |
2876 | 2876 | // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic |
2877 | 2877 | $hasAsian = (($optionFlags & 0x04) != 0); |
@@ -3385,7 +3385,7 @@ discard block |
||
3385 | 3385 | |
3386 | 3386 | // bit 0, mask 0x01; 1 = sheet is protected |
3387 | 3387 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3388 | - $this->phpSheet->getProtection()->setSheet((bool)$bool); |
|
3388 | + $this->phpSheet->getProtection()->setSheet((bool) $bool); |
|
3389 | 3389 | } |
3390 | 3390 | |
3391 | 3391 | |
@@ -3409,7 +3409,7 @@ discard block |
||
3409 | 3409 | // bit: 0, mask 0x01; 1 = scenarios are protected |
3410 | 3410 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3411 | 3411 | |
3412 | - $this->phpSheet->getProtection()->setScenarios((bool)$bool); |
|
3412 | + $this->phpSheet->getProtection()->setScenarios((bool) $bool); |
|
3413 | 3413 | } |
3414 | 3414 | |
3415 | 3415 | |
@@ -3433,7 +3433,7 @@ discard block |
||
3433 | 3433 | // bit: 0, mask 0x01; 1 = objects are protected |
3434 | 3434 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3435 | 3435 | |
3436 | - $this->phpSheet->getProtection()->setObjects((bool)$bool); |
|
3436 | + $this->phpSheet->getProtection()->setObjects((bool) $bool); |
|
3437 | 3437 | } |
3438 | 3438 | |
3439 | 3439 | |
@@ -3869,7 +3869,7 @@ discard block |
||
3869 | 3869 | // get the base cell, grab tExp token |
3870 | 3870 | $baseRow = self::getInt2d($formulaStructure, 3); |
3871 | 3871 | $baseCol = self::getInt2d($formulaStructure, 5); |
3872 | - $this->_baseCell = \PhpSpreadsheet\Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); |
|
3872 | + $this->_baseCell = \PhpSpreadsheet\Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1); |
|
3873 | 3873 | } |
3874 | 3874 | |
3875 | 3875 | // Read cell? |
@@ -4298,7 +4298,7 @@ discard block |
||
4298 | 4298 | $this->frozen = (bool) ((0x0008 & $options) >> 3); |
4299 | 4299 | |
4300 | 4300 | // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left |
4301 | - $this->phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); |
|
4301 | + $this->phpSheet->setRightToLeft((bool) ((0x0040 & $options) >> 6)); |
|
4302 | 4302 | |
4303 | 4303 | // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active |
4304 | 4304 | $isActive = (bool) ((0x0400 & $options) >> 10); |
@@ -4873,9 +4873,9 @@ discard block |
||
4873 | 4873 | $objValidation = $this->phpSheet->getCell($coordinate)->getDataValidation(); |
4874 | 4874 | $objValidation->setType($type); |
4875 | 4875 | $objValidation->setErrorStyle($errorStyle); |
4876 | - $objValidation->setAllowBlank((bool)$allowBlank); |
|
4877 | - $objValidation->setShowInputMessage((bool)$showInputMessage); |
|
4878 | - $objValidation->setShowErrorMessage((bool)$showErrorMessage); |
|
4876 | + $objValidation->setAllowBlank((bool) $allowBlank); |
|
4877 | + $objValidation->setShowInputMessage((bool) $showInputMessage); |
|
4878 | + $objValidation->setShowErrorMessage((bool) $showErrorMessage); |
|
4879 | 4879 | $objValidation->setShowDropDown(!$suppressDropDown); |
4880 | 4880 | $objValidation->setOperator($operator); |
4881 | 4881 | $objValidation->setErrorTitle($errorTitle); |
@@ -5700,7 +5700,7 @@ discard block |
||
5700 | 5700 | $name = 'tNum'; |
5701 | 5701 | $size = 9; |
5702 | 5702 | $data = self::extractNumber(substr($formulaData, 1)); |
5703 | - $data = str_replace(',', '.', (string)$data); // in case non-English locale |
|
5703 | + $data = str_replace(',', '.', (string) $data); // in case non-English locale |
|
5704 | 5704 | break; |
5705 | 5705 | case 0x20: // array constant |
5706 | 5706 | case 0x40: |
@@ -7470,7 +7470,7 @@ discard block |
||
7470 | 7470 | $sign = ($rknum & 0x80000000) >> 31; |
7471 | 7471 | $exp = ($rknum & 0x7ff00000) >> 20; |
7472 | 7472 | $mantissa = (0x100000 | ($rknum & 0x000ffffc)); |
7473 | - $value = $mantissa / pow(2, (20- ($exp - 1023))); |
|
7473 | + $value = $mantissa / pow(2, (20 - ($exp - 1023))); |
|
7474 | 7474 | if ($sign) { |
7475 | 7475 | $value = -1 * $value; |
7476 | 7476 | } |
@@ -7539,7 +7539,7 @@ discard block |
||
7539 | 7539 | */ |
7540 | 7540 | public static function getInt2d($data, $pos) |
7541 | 7541 | { |
7542 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); |
|
7542 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); |
|
7543 | 7543 | } |
7544 | 7544 | |
7545 | 7545 | |
@@ -7562,7 +7562,7 @@ discard block |
||
7562 | 7562 | } else { |
7563 | 7563 | $_ord_24 = ($_or_24 & 127) << 24; |
7564 | 7564 | } |
7565 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24; |
|
7565 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; |
|
7566 | 7566 | } |
7567 | 7567 | |
7568 | 7568 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'SimpleXMLElement', |
138 | 138 | \PhpSpreadsheet\Settings::getLibXmlLoaderOptions() |
139 | 139 | ) |
140 | - ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" |
|
140 | + ); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main" |
|
141 | 141 | |
142 | 142 | if ($xmlWorkbook->sheets) { |
143 | 143 | foreach ($xmlWorkbook->sheets->sheet as $eleSheet) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $xml = new \XMLReader(); |
225 | 225 | $res = $xml->xml( |
226 | 226 | $this->securityScanFile( |
227 | - 'zip://'.\PhpSpreadsheet\Shared\File::realpath($pFilename).'#'."$dir/$fileWorksheet" |
|
227 | + 'zip://' . \PhpSpreadsheet\Shared\File::realpath($pFilename) . '#' . "$dir/$fileWorksheet" |
|
228 | 228 | ), |
229 | 229 | null, |
230 | 230 | \PhpSpreadsheet\Settings::getLibXmlLoaderOptions() |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } elseif ($value == '1') { |
269 | 269 | return true; |
270 | 270 | } else { |
271 | - return (bool)$c->v; |
|
271 | + return (bool) $c->v; |
|
272 | 272 | } |
273 | 273 | return $value; |
274 | 274 | } |
@@ -294,15 +294,15 @@ discard block |
||
294 | 294 | $calculatedValue = self::$castBaseType($c); |
295 | 295 | |
296 | 296 | // Shared formula? |
297 | - if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') { |
|
297 | + if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') { |
|
298 | 298 | // echo 'SHARED FORMULA', PHP_EOL; |
299 | - $instance = (string)$c->f['si']; |
|
299 | + $instance = (string) $c->f['si']; |
|
300 | 300 | |
301 | 301 | // echo 'Instance ID = ', $instance, PHP_EOL; |
302 | 302 | // |
303 | 303 | // echo 'Shared Formula Array:', PHP_EOL; |
304 | 304 | // print_r($sharedFormulas); |
305 | - if (!isset($sharedFormulas[(string)$c->f['si']])) { |
|
305 | + if (!isset($sharedFormulas[(string) $c->f['si']])) { |
|
306 | 306 | // echo 'SETTING NEW SHARED FORMULA', PHP_EOL; |
307 | 307 | // echo 'Master is ', $r, PHP_EOL; |
308 | 308 | // echo 'Formula is ', $value, PHP_EOL; |
@@ -400,10 +400,10 @@ discard block |
||
400 | 400 | if (is_object($xmlTheme)) { |
401 | 401 | $xmlThemeName = $xmlTheme->attributes(); |
402 | 402 | $xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
403 | - $themeName = (string)$xmlThemeName['name']; |
|
403 | + $themeName = (string) $xmlThemeName['name']; |
|
404 | 404 | |
405 | 405 | $colourScheme = $xmlTheme->themeElements->clrScheme->attributes(); |
406 | - $colourSchemeName = (string)$colourScheme['name']; |
|
406 | + $colourSchemeName = (string) $colourScheme['name']; |
|
407 | 407 | $colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main"); |
408 | 408 | |
409 | 409 | $themeColours = array(); |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | if (!is_null($macros)) { |
547 | - $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin');//vbaProject.bin always in 'xl' dir and always named vbaProject.bin |
|
547 | + $macrosCode = $this->getFromZipArchive($zip, 'xl/vbaProject.bin'); //vbaProject.bin always in 'xl' dir and always named vbaProject.bin |
|
548 | 548 | if ($macrosCode !== false) { |
549 | 549 | $excel->setMacrosCode($macrosCode); |
550 | 550 | $excel->setHasMacros(true); |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | // We shouldn't override any of the built-in MS Excel values (values below id 164) |
588 | 588 | // But there's a lot of naughty homebrew xlsx writers that do use "reserved" id values that aren't actually used |
589 | 589 | // So we make allowance for them rather than lose formatting masks |
590 | - if ((int)$xf["numFmtId"] < 164 && |
|
591 | - \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int)$xf["numFmtId"]) !== '') { |
|
592 | - $numFmt = \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
590 | + if ((int) $xf["numFmtId"] < 164 && |
|
591 | + \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int) $xf["numFmtId"]) !== '') { |
|
592 | + $numFmt = \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 | $quotePrefix = false; |
@@ -620,8 +620,8 @@ discard block |
||
620 | 620 | $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]")); |
621 | 621 | if (isset($tmpNumFmt["formatCode"])) { |
622 | 622 | $numFmt = (string) $tmpNumFmt["formatCode"]; |
623 | - } elseif ((int)$xf["numFmtId"] < 165) { |
|
624 | - $numFmt = \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int)$xf["numFmtId"]); |
|
623 | + } elseif ((int) $xf["numFmtId"] < 165) { |
|
624 | + $numFmt = \PhpSpreadsheet\Style\NumberFormat::builtInFormatCode((int) $xf["numFmtId"]); |
|
625 | 625 | } |
626 | 626 | } |
627 | 627 | |
@@ -740,17 +740,17 @@ discard block |
||
740 | 740 | $docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']); |
741 | 741 | } |
742 | 742 | if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) { |
743 | - $docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines'])); |
|
743 | + $docSheet->setShowGridLines(self::boolean((string) $xmlSheet->sheetViews->sheetView['showGridLines'])); |
|
744 | 744 | } |
745 | 745 | if (isset($xmlSheet->sheetViews->sheetView['showRowColHeaders'])) { |
746 | - $docSheet->setShowRowColHeaders(self::boolean((string)$xmlSheet->sheetViews->sheetView['showRowColHeaders'])); |
|
746 | + $docSheet->setShowRowColHeaders(self::boolean((string) $xmlSheet->sheetViews->sheetView['showRowColHeaders'])); |
|
747 | 747 | } |
748 | 748 | if (isset($xmlSheet->sheetViews->sheetView['rightToLeft'])) { |
749 | - $docSheet->setRightToLeft(self::boolean((string)$xmlSheet->sheetViews->sheetView['rightToLeft'])); |
|
749 | + $docSheet->setRightToLeft(self::boolean((string) $xmlSheet->sheetViews->sheetView['rightToLeft'])); |
|
750 | 750 | } |
751 | 751 | if (isset($xmlSheet->sheetViews->sheetView->pane)) { |
752 | 752 | if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) { |
753 | - $docSheet->freezePane((string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell']); |
|
753 | + $docSheet->freezePane((string) $xmlSheet->sheetViews->sheetView->pane['topLeftCell']); |
|
754 | 754 | } else { |
755 | 755 | $xSplit = 0; |
756 | 756 | $ySplit = 0; |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | |
770 | 770 | if (isset($xmlSheet->sheetViews->sheetView->selection)) { |
771 | 771 | if (isset($xmlSheet->sheetViews->sheetView->selection['sqref'])) { |
772 | - $sqref = (string)$xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
772 | + $sqref = (string) $xmlSheet->sheetViews->sheetView->selection['sqref']; |
|
773 | 773 | $sqref = explode(' ', $sqref); |
774 | 774 | $sqref = $sqref[0]; |
775 | 775 | $docSheet->setSelectedCells($sqref); |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | |
780 | 780 | if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) { |
781 | 781 | if (isset($xmlSheet->sheetPr->tabColor['rgb'])) { |
782 | - $docSheet->getTabColor()->setARGB((string)$xmlSheet->sheetPr->tabColor['rgb']); |
|
782 | + $docSheet->getTabColor()->setARGB((string) $xmlSheet->sheetPr->tabColor['rgb']); |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr['codeName'])) { |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | if (isset($xmlSheet->sheetFormatPr['customHeight']) && |
815 | 815 | self::boolean((string) $xmlSheet->sheetFormatPr['customHeight']) && |
816 | 816 | isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) { |
817 | - $docSheet->getDefaultRowDimension()->setRowHeight((float)$xmlSheet->sheetFormatPr['defaultRowHeight']); |
|
817 | + $docSheet->getDefaultRowDimension()->setRowHeight((float) $xmlSheet->sheetFormatPr['defaultRowHeight']); |
|
818 | 818 | } |
819 | 819 | if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) { |
820 | - $docSheet->getDefaultColumnDimension()->setWidth((float)$xmlSheet->sheetFormatPr['defaultColWidth']); |
|
820 | + $docSheet->getDefaultColumnDimension()->setWidth((float) $xmlSheet->sheetFormatPr['defaultColWidth']); |
|
821 | 821 | } |
822 | 822 | if (isset($xmlSheet->sheetFormatPr['zeroHeight']) && |
823 | - ((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) { |
|
823 | + ((string) $xmlSheet->sheetFormatPr['zeroHeight'] == '1')) { |
|
824 | 824 | $docSheet->getDefaultRowDimension()->setZeroHeight(true); |
825 | 825 | } |
826 | 826 | } |
@@ -887,10 +887,10 @@ discard block |
||
887 | 887 | } |
888 | 888 | |
889 | 889 | foreach ($row->c as $c) { |
890 | - $r = (string) $c["r"]; |
|
890 | + $r = (string) $c["r"]; |
|
891 | 891 | $cellDataType = (string) $c["t"]; |
892 | 892 | $value = null; |
893 | - $calculatedValue = null; |
|
893 | + $calculatedValue = null; |
|
894 | 894 | |
895 | 895 | // Read cell? |
896 | 896 | if ($this->getReadFilter() !== null) { |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | switch ($cellDataType) { |
911 | 911 | case "s": |
912 | 912 | // echo 'String', PHP_EOL; |
913 | - if ((string)$c->v != '') { |
|
913 | + if ((string) $c->v != '') { |
|
914 | 914 | $value = $sharedStrings[intval($c->v)]; |
915 | 915 | |
916 | 916 | if ($value instanceof \PhpSpreadsheet\RichText) { |
@@ -970,12 +970,12 @@ discard block |
||
970 | 970 | |
971 | 971 | // Check for numeric values |
972 | 972 | if (is_numeric($value) && $cellDataType != 's') { |
973 | - if ($value == (int)$value) { |
|
974 | - $value = (int)$value; |
|
975 | - } elseif ($value == (float)$value) { |
|
976 | - $value = (float)$value; |
|
977 | - } elseif ($value == (double)$value) { |
|
978 | - $value = (double)$value; |
|
973 | + if ($value == (int) $value) { |
|
974 | + $value = (int) $value; |
|
975 | + } elseif ($value == (float) $value) { |
|
976 | + $value = (float) $value; |
|
977 | + } elseif ($value == (double) $value) { |
|
978 | + $value = (double) $value; |
|
979 | 979 | } |
980 | 980 | } |
981 | 981 | |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | if (!$this->readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) { |
1010 | 1010 | foreach ($xmlSheet->conditionalFormatting as $conditional) { |
1011 | 1011 | foreach ($conditional->cfRule as $cfRule) { |
1012 | - if (((string)$cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string)$cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) { |
|
1012 | + if (((string) $cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_NONE || (string) $cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS || (string) $cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_CONTAINSTEXT || (string) $cfRule["type"] == \PhpSpreadsheet\Style\Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) { |
|
1013 | 1013 | $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule; |
1014 | 1014 | } |
1015 | 1015 | } |
@@ -1020,19 +1020,19 @@ discard block |
||
1020 | 1020 | $conditionalStyles = array(); |
1021 | 1021 | foreach ($cfRules as $cfRule) { |
1022 | 1022 | $objConditional = new \PhpSpreadsheet\Style\Conditional(); |
1023 | - $objConditional->setConditionType((string)$cfRule["type"]); |
|
1024 | - $objConditional->setOperatorType((string)$cfRule["operator"]); |
|
1023 | + $objConditional->setConditionType((string) $cfRule["type"]); |
|
1024 | + $objConditional->setOperatorType((string) $cfRule["operator"]); |
|
1025 | 1025 | |
1026 | - if ((string)$cfRule["text"] != '') { |
|
1027 | - $objConditional->setText((string)$cfRule["text"]); |
|
1026 | + if ((string) $cfRule["text"] != '') { |
|
1027 | + $objConditional->setText((string) $cfRule["text"]); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | if (count($cfRule->formula) > 1) { |
1031 | 1031 | foreach ($cfRule->formula as $formula) { |
1032 | - $objConditional->addCondition((string)$formula); |
|
1032 | + $objConditional->addCondition((string) $formula); |
|
1033 | 1033 | } |
1034 | 1034 | } else { |
1035 | - $objConditional->addCondition((string)$cfRule->formula); |
|
1035 | + $objConditional->addCondition((string) $cfRule->formula); |
|
1036 | 1036 | } |
1037 | 1037 | $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]); |
1038 | 1038 | $conditionalStyles[] = $objConditional; |
@@ -1210,25 +1210,25 @@ discard block |
||
1210 | 1210 | $docHeaderFooter = $docSheet->getHeaderFooter(); |
1211 | 1211 | |
1212 | 1212 | if (isset($xmlSheet->headerFooter["differentOddEven"]) && |
1213 | - self::boolean((string)$xmlSheet->headerFooter["differentOddEven"])) { |
|
1213 | + self::boolean((string) $xmlSheet->headerFooter["differentOddEven"])) { |
|
1214 | 1214 | $docHeaderFooter->setDifferentOddEven(true); |
1215 | 1215 | } else { |
1216 | 1216 | $docHeaderFooter->setDifferentOddEven(false); |
1217 | 1217 | } |
1218 | 1218 | if (isset($xmlSheet->headerFooter["differentFirst"]) && |
1219 | - self::boolean((string)$xmlSheet->headerFooter["differentFirst"])) { |
|
1219 | + self::boolean((string) $xmlSheet->headerFooter["differentFirst"])) { |
|
1220 | 1220 | $docHeaderFooter->setDifferentFirst(true); |
1221 | 1221 | } else { |
1222 | 1222 | $docHeaderFooter->setDifferentFirst(false); |
1223 | 1223 | } |
1224 | 1224 | if (isset($xmlSheet->headerFooter["scaleWithDoc"]) && |
1225 | - !self::boolean((string)$xmlSheet->headerFooter["scaleWithDoc"])) { |
|
1225 | + !self::boolean((string) $xmlSheet->headerFooter["scaleWithDoc"])) { |
|
1226 | 1226 | $docHeaderFooter->setScaleWithDocument(false); |
1227 | 1227 | } else { |
1228 | 1228 | $docHeaderFooter->setScaleWithDocument(true); |
1229 | 1229 | } |
1230 | 1230 | if (isset($xmlSheet->headerFooter["alignWithMargins"]) && |
1231 | - !self::boolean((string)$xmlSheet->headerFooter["alignWithMargins"])) { |
|
1231 | + !self::boolean((string) $xmlSheet->headerFooter["alignWithMargins"])) { |
|
1232 | 1232 | $docHeaderFooter->setAlignWithMargins(false); |
1233 | 1233 | } else { |
1234 | 1234 | $docHeaderFooter->setAlignWithMargins(true); |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | ); |
1303 | 1303 | foreach ($relsWorksheet->Relationship as $ele) { |
1304 | 1304 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") { |
1305 | - $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
1305 | + $hyperlinks[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
1306 | 1306 | } |
1307 | 1307 | } |
1308 | 1308 | } |
@@ -1316,18 +1316,18 @@ discard block |
||
1316 | 1316 | foreach (\PhpSpreadsheet\Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { |
1317 | 1317 | $cell = $docSheet->getCell($cellReference); |
1318 | 1318 | if (isset($linkRel['id'])) { |
1319 | - $hyperlinkUrl = $hyperlinks[ (string)$linkRel['id'] ]; |
|
1319 | + $hyperlinkUrl = $hyperlinks[(string) $linkRel['id']]; |
|
1320 | 1320 | if (isset($hyperlink['location'])) { |
1321 | 1321 | $hyperlinkUrl .= '#' . (string) $hyperlink['location']; |
1322 | 1322 | } |
1323 | 1323 | $cell->getHyperlink()->setUrl($hyperlinkUrl); |
1324 | 1324 | } elseif (isset($hyperlink['location'])) { |
1325 | - $cell->getHyperlink()->setUrl('sheet://' . (string)$hyperlink['location']); |
|
1325 | + $cell->getHyperlink()->setUrl('sheet://' . (string) $hyperlink['location']); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | // Tooltip |
1329 | 1329 | if (isset($hyperlink['tooltip'])) { |
1330 | - $cell->getHyperlink()->setTooltip((string)$hyperlink['tooltip']); |
|
1330 | + $cell->getHyperlink()->setTooltip((string) $hyperlink['tooltip']); |
|
1331 | 1331 | } |
1332 | 1332 | } |
1333 | 1333 | } |
@@ -1350,10 +1350,10 @@ discard block |
||
1350 | 1350 | ); |
1351 | 1351 | foreach ($relsWorksheet->Relationship as $ele) { |
1352 | 1352 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") { |
1353 | - $comments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
1353 | + $comments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
1354 | 1354 | } |
1355 | 1355 | if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") { |
1356 | - $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"]; |
|
1356 | + $vmlComments[(string) $ele["Id"]] = (string) $ele["Target"]; |
|
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | } |
@@ -1373,15 +1373,15 @@ discard block |
||
1373 | 1373 | |
1374 | 1374 | // Loop through authors |
1375 | 1375 | foreach ($commentsFile->authors->author as $author) { |
1376 | - $authors[] = (string)$author; |
|
1376 | + $authors[] = (string) $author; |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | // Loop through contents |
1380 | 1380 | foreach ($commentsFile->commentList->comment as $comment) { |
1381 | 1381 | if (!empty($comment['authorId'])) { |
1382 | - $docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]); |
|
1382 | + $docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]); |
|
1383 | 1383 | } |
1384 | - $docSheet->getComment((string)$comment['ref'])->setText($this->parseRichText($comment->text)); |
|
1384 | + $docSheet->getComment((string) $comment['ref'])->setText($this->parseRichText($comment->text)); |
|
1385 | 1385 | } |
1386 | 1386 | } |
1387 | 1387 | |
@@ -1401,16 +1401,16 @@ discard block |
||
1401 | 1401 | $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); |
1402 | 1402 | |
1403 | 1403 | if (isset($shape['style'])) { |
1404 | - $style = (string)$shape['style']; |
|
1405 | - $fillColor = strtoupper(substr((string)$shape['fillcolor'], 1)); |
|
1404 | + $style = (string) $shape['style']; |
|
1405 | + $fillColor = strtoupper(substr((string) $shape['fillcolor'], 1)); |
|
1406 | 1406 | $column = null; |
1407 | 1407 | $row = null; |
1408 | 1408 | |
1409 | 1409 | $clientData = $shape->xpath('.//x:ClientData'); |
1410 | 1410 | if (is_array($clientData) && !empty($clientData)) { |
1411 | - $clientData = $clientData[0]; |
|
1411 | + $clientData = $clientData[0]; |
|
1412 | 1412 | |
1413 | - if (isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note') { |
|
1413 | + if (isset($clientData['ObjectType']) && (string) $clientData['ObjectType'] == 'Note') { |
|
1414 | 1414 | $temp = $clientData->xpath('.//x:Row'); |
1415 | 1415 | if (is_array($temp)) { |
1416 | 1416 | $row = $temp[0]; |
@@ -1507,14 +1507,14 @@ discard block |
||
1507 | 1507 | $imageData = $imageData[$idx]; |
1508 | 1508 | |
1509 | 1509 | $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office'); |
1510 | - $style = self::toCSSArray((string)$shape['style']); |
|
1510 | + $style = self::toCSSArray((string) $shape['style']); |
|
1511 | 1511 | |
1512 | 1512 | $hfImages[(string) $shape['id']] = new \PhpSpreadsheet\Worksheet\HeaderFooterDrawing(); |
1513 | 1513 | if (isset($imageData['title'])) { |
1514 | - $hfImages[(string) $shape['id']]->setName((string)$imageData['title']); |
|
1514 | + $hfImages[(string) $shape['id']]->setName((string) $imageData['title']); |
|
1515 | 1515 | } |
1516 | 1516 | |
1517 | - $hfImages[(string) $shape['id']]->setPath("zip://".\PhpSpreadsheet\Shared_File::realpath($pFilename)."#" . $drawings[(string)$imageData['relid']], false); |
|
1517 | + $hfImages[(string) $shape['id']]->setPath("zip://" . \PhpSpreadsheet\Shared_File::realpath($pFilename) . "#" . $drawings[(string) $imageData['relid']], false); |
|
1518 | 1518 | $hfImages[(string) $shape['id']]->setResizeProportional(false); |
1519 | 1519 | $hfImages[(string) $shape['id']]->setWidth($style['width']); |
1520 | 1520 | $hfImages[(string) $shape['id']]->setHeight($style['height']); |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $objDrawing->setName((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
1591 | 1591 | $objDrawing->setDescription((string) self::getArrayItem($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
1592 | 1592 | $objDrawing->setPath( |
1593 | - "zip://".\PhpSpreadsheet\Shared\File::realpath($pFilename)."#" . |
|
1593 | + "zip://" . \PhpSpreadsheet\Shared\File::realpath($pFilename) . "#" . |
|
1594 | 1594 | $images[(string) self::getArrayItem( |
1595 | 1595 | $blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), |
1596 | 1596 | "embed" |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | $objDrawing->setName((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name")); |
1638 | 1638 | $objDrawing->setDescription((string) self::getArrayItem($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr")); |
1639 | 1639 | $objDrawing->setPath( |
1640 | - "zip://".\PhpSpreadsheet\Shared\File::realpath($pFilename)."#" . |
|
1640 | + "zip://" . \PhpSpreadsheet\Shared\File::realpath($pFilename) . "#" . |
|
1641 | 1641 | $images[(string) self::getArrayItem( |
1642 | 1642 | $blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), |
1643 | 1643 | "embed" |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | $chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart; |
1677 | 1677 | $thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); |
1678 | 1678 | |
1679 | - $chartDetails[$docSheet->getTitle().'!'.$thisChart] = array( |
|
1679 | + $chartDetails[$docSheet->getTitle() . '!' . $thisChart] = array( |
|
1680 | 1680 | 'fromCoordinate' => $fromCoordinate, |
1681 | 1681 | 'fromOffsetX' => $fromOffsetX, |
1682 | 1682 | 'fromOffsetY' => $fromOffsetY, |
@@ -1696,25 +1696,25 @@ discard block |
||
1696 | 1696 | if ($xmlWorkbook->definedNames) { |
1697 | 1697 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
1698 | 1698 | // Extract range |
1699 | - $extractedRange = (string)$definedName; |
|
1699 | + $extractedRange = (string) $definedName; |
|
1700 | 1700 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
1701 | 1701 | if (($spos = strpos($extractedRange, '!')) !== false) { |
1702 | - $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
1702 | + $extractedRange = substr($extractedRange, 0, $spos) . str_replace('$', '', substr($extractedRange, $spos)); |
|
1703 | 1703 | } else { |
1704 | 1704 | $extractedRange = str_replace('$', '', $extractedRange); |
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | // Valid range? |
1708 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
1708 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
1709 | 1709 | continue; |
1710 | 1710 | } |
1711 | 1711 | |
1712 | 1712 | // Some definedNames are only applicable if we are on the same sheet... |
1713 | - if ((string)$definedName['localSheetId'] != '' && (string)$definedName['localSheetId'] == $sheetId) { |
|
1713 | + if ((string) $definedName['localSheetId'] != '' && (string) $definedName['localSheetId'] == $sheetId) { |
|
1714 | 1714 | // Switch on type |
1715 | - switch ((string)$definedName['name']) { |
|
1715 | + switch ((string) $definedName['name']) { |
|
1716 | 1716 | case '_xlnm._FilterDatabase': |
1717 | - if ((string)$definedName['hidden'] !== '1') { |
|
1717 | + if ((string) $definedName['hidden'] !== '1') { |
|
1718 | 1718 | $extractedRange = explode(',', $extractedRange); |
1719 | 1719 | foreach ($extractedRange as $range) { |
1720 | 1720 | $autoFilterRange = $range; |
@@ -1743,10 +1743,10 @@ discard block |
||
1743 | 1743 | } |
1744 | 1744 | break; |
1745 | 1745 | case '_xlnm.Print_Area': |
1746 | - $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
1746 | + $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? |
|
1747 | 1747 | $newRangeSets = array(); |
1748 | 1748 | foreach ($rangeSets as $rangeSet) { |
1749 | - $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
1749 | + $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? |
|
1750 | 1750 | $rangeSet = isset($range[1]) ? $range[1] : $range[0]; |
1751 | 1751 | if (strpos($rangeSet, ':') === false) { |
1752 | 1752 | $rangeSet = $rangeSet . ':' . $rangeSet; |
@@ -1771,38 +1771,38 @@ discard block |
||
1771 | 1771 | if ($xmlWorkbook->definedNames) { |
1772 | 1772 | foreach ($xmlWorkbook->definedNames->definedName as $definedName) { |
1773 | 1773 | // Extract range |
1774 | - $extractedRange = (string)$definedName; |
|
1774 | + $extractedRange = (string) $definedName; |
|
1775 | 1775 | $extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange); |
1776 | 1776 | if (($spos = strpos($extractedRange, '!')) !== false) { |
1777 | - $extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos)); |
|
1777 | + $extractedRange = substr($extractedRange, 0, $spos) . str_replace('$', '', substr($extractedRange, $spos)); |
|
1778 | 1778 | } else { |
1779 | 1779 | $extractedRange = str_replace('$', '', $extractedRange); |
1780 | 1780 | } |
1781 | 1781 | |
1782 | 1782 | // Valid range? |
1783 | - if (stripos((string)$definedName, '#REF!') !== false || $extractedRange == '') { |
|
1783 | + if (stripos((string) $definedName, '#REF!') !== false || $extractedRange == '') { |
|
1784 | 1784 | continue; |
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | // Some definedNames are only applicable if we are on the same sheet... |
1788 | - if ((string)$definedName['localSheetId'] != '') { |
|
1788 | + if ((string) $definedName['localSheetId'] != '') { |
|
1789 | 1789 | // Local defined name |
1790 | 1790 | // Switch on type |
1791 | - switch ((string)$definedName['name']) { |
|
1791 | + switch ((string) $definedName['name']) { |
|
1792 | 1792 | case '_xlnm._FilterDatabase': |
1793 | 1793 | case '_xlnm.Print_Titles': |
1794 | 1794 | case '_xlnm.Print_Area': |
1795 | 1795 | break; |
1796 | 1796 | default: |
1797 | 1797 | if ($mapSheetId[(integer) $definedName['localSheetId']] !== null) { |
1798 | - $range = explode('!', (string)$definedName); |
|
1798 | + $range = explode('!', (string) $definedName); |
|
1799 | 1799 | if (count($range) == 2) { |
1800 | 1800 | $range[0] = str_replace("''", "'", $range[0]); |
1801 | 1801 | $range[0] = str_replace("'", "", $range[0]); |
1802 | 1802 | if ($worksheet = $docSheet->getParent()->getSheetByName($range[0])) { |
1803 | 1803 | $extractedRange = str_replace('$', '', $range[1]); |
1804 | 1804 | $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName['localSheetId']]); |
1805 | - $excel->addNamedRange(new \PhpSpreadsheet\NamedRange((string)$definedName['name'], $worksheet, $extractedRange, true, $scope)); |
|
1805 | + $excel->addNamedRange(new \PhpSpreadsheet\NamedRange((string) $definedName['name'], $worksheet, $extractedRange, true, $scope)); |
|
1806 | 1806 | } |
1807 | 1807 | } |
1808 | 1808 | } |
@@ -1812,9 +1812,9 @@ discard block |
||
1812 | 1812 | // "Global" definedNames |
1813 | 1813 | $locatedSheet = null; |
1814 | 1814 | $extractedSheetName = ''; |
1815 | - if (strpos((string)$definedName, '!') !== false) { |
|
1815 | + if (strpos((string) $definedName, '!') !== false) { |
|
1816 | 1816 | // Extract sheet name |
1817 | - $extractedSheetName = \PhpSpreadsheet\Worksheet::extractSheetTitle((string)$definedName, true); |
|
1817 | + $extractedSheetName = \PhpSpreadsheet\Worksheet::extractSheetTitle((string) $definedName, true); |
|
1818 | 1818 | $extractedSheetName = $extractedSheetName[0]; |
1819 | 1819 | |
1820 | 1820 | // Locate sheet |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | if ($locatedSheet !== null) { |
1829 | - $excel->addNamedRange(new \PhpSpreadsheet\NamedRange((string)$definedName['name'], $locatedSheet, $extractedRange, false)); |
|
1829 | + $excel->addNamedRange(new \PhpSpreadsheet\NamedRange((string) $definedName['name'], $locatedSheet, $extractedRange, false)); |
|
1830 | 1830 | } |
1831 | 1831 | } |
1832 | 1832 | } |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | // var_dump($charts[$chartEntryRef]); |
1878 | 1878 | // |
1879 | 1879 | if (isset($charts[$chartEntryRef])) { |
1880 | - $chartPositionRef = $charts[$chartEntryRef]['sheet'].'!'.$charts[$chartEntryRef]['id']; |
|
1880 | + $chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id']; |
|
1881 | 1881 | // echo 'Position Ref ', $chartPositionRef, '<br />'; |
1882 | 1882 | if (isset($chartDetails[$chartPositionRef])) { |
1883 | 1883 | // var_dump($chartDetails[$chartPositionRef]); |
@@ -1901,17 +1901,17 @@ discard block |
||
1901 | 1901 | private static function readColor($color, $background = false) |
1902 | 1902 | { |
1903 | 1903 | if (isset($color["rgb"])) { |
1904 | - return (string)$color["rgb"]; |
|
1904 | + return (string) $color["rgb"]; |
|
1905 | 1905 | } elseif (isset($color["indexed"])) { |
1906 | - return \PhpSpreadsheet\Style\Color::indexedColor($color["indexed"]-7, $background)->getARGB(); |
|
1906 | + return \PhpSpreadsheet\Style\Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
1907 | 1907 | } elseif (isset($color["theme"])) { |
1908 | 1908 | if (self::$theme !== null) { |
1909 | - $returnColour = self::$theme->getColourByIndex((int)$color["theme"]); |
|
1909 | + $returnColour = self::$theme->getColourByIndex((int) $color["theme"]); |
|
1910 | 1910 | if (isset($color["tint"])) { |
1911 | 1911 | $tintAdjust = (float) $color["tint"]; |
1912 | 1912 | $returnColour = \PhpSpreadsheet\Style\Color::changeBrightness($returnColour, $tintAdjust); |
1913 | 1913 | } |
1914 | - return 'FF'.$returnColour; |
|
1914 | + return 'FF' . $returnColour; |
|
1915 | 1915 | } |
1916 | 1916 | } |
1917 | 1917 | |
@@ -1950,11 +1950,11 @@ discard block |
||
1950 | 1950 | if (isset($style->font->u) && !isset($style->font->u["val"])) { |
1951 | 1951 | $docStyle->getFont()->setUnderline(\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); |
1952 | 1952 | } elseif (isset($style->font->u) && isset($style->font->u["val"])) { |
1953 | - $docStyle->getFont()->setUnderline((string)$style->font->u["val"]); |
|
1953 | + $docStyle->getFont()->setUnderline((string) $style->font->u["val"]); |
|
1954 | 1954 | } |
1955 | 1955 | |
1956 | 1956 | if (isset($style->font->vertAlign) && isset($style->font->vertAlign["val"])) { |
1957 | - $vertAlign = strtolower((string)$style->font->vertAlign["val"]); |
|
1957 | + $vertAlign = strtolower((string) $style->font->vertAlign["val"]); |
|
1958 | 1958 | if ($vertAlign == 'superscript') { |
1959 | 1959 | $docStyle->getFont()->setSuperScript(true); |
1960 | 1960 | } |
@@ -1976,7 +1976,7 @@ discard block |
||
1976 | 1976 | $docStyle->getFill()->getStartColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath("sml:stop[@position=0]"))->color)); |
1977 | 1977 | $docStyle->getFill()->getEndColor()->setARGB(self::readColor(self::getArrayItem($gradientFill->xpath("sml:stop[@position=1]"))->color)); |
1978 | 1978 | } elseif ($style->fill->patternFill) { |
1979 | - $patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid'; |
|
1979 | + $patternType = (string) $style->fill->patternFill["patternType"] != '' ? (string) $style->fill->patternFill["patternType"] : 'solid'; |
|
1980 | 1980 | $docStyle->getFill()->setFillType($patternType); |
1981 | 1981 | if ($style->fill->patternFill->fgColor) { |
1982 | 1982 | $docStyle->getFill()->getStartColor()->setARGB(self::readColor($style->fill->patternFill->fgColor, true)); |
@@ -2015,17 +2015,17 @@ discard block |
||
2015 | 2015 | $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]); |
2016 | 2016 | |
2017 | 2017 | $textRotation = 0; |
2018 | - if ((int)$style->alignment["textRotation"] <= 90) { |
|
2019 | - $textRotation = (int)$style->alignment["textRotation"]; |
|
2020 | - } elseif ((int)$style->alignment["textRotation"] > 90) { |
|
2021 | - $textRotation = 90 - (int)$style->alignment["textRotation"]; |
|
2018 | + if ((int) $style->alignment["textRotation"] <= 90) { |
|
2019 | + $textRotation = (int) $style->alignment["textRotation"]; |
|
2020 | + } elseif ((int) $style->alignment["textRotation"] > 90) { |
|
2021 | + $textRotation = 90 - (int) $style->alignment["textRotation"]; |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | $docStyle->getAlignment()->setTextRotation(intval($textRotation)); |
2025 | 2025 | $docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment["wrapText"])); |
2026 | 2026 | $docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment["shrinkToFit"])); |
2027 | - $docStyle->getAlignment()->setIndent(intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0); |
|
2028 | - $docStyle->getAlignment()->setReadorder(intval((string)$style->alignment["readingOrder"]) > 0 ? intval((string)$style->alignment["readingOrder"]) : 0); |
|
2027 | + $docStyle->getAlignment()->setIndent(intval((string) $style->alignment["indent"]) > 0 ? intval((string) $style->alignment["indent"]) : 0); |
|
2028 | + $docStyle->getAlignment()->setReadorder(intval((string) $style->alignment["readingOrder"]) > 0 ? intval((string) $style->alignment["readingOrder"]) : 0); |
|
2029 | 2029 | } |
2030 | 2030 | |
2031 | 2031 | // protection |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | $objText->getFont()->setItalic(true); |
2096 | 2096 | } |
2097 | 2097 | if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) { |
2098 | - $vertAlign = strtolower((string)$run->rPr->vertAlign["val"]); |
|
2098 | + $vertAlign = strtolower((string) $run->rPr->vertAlign["val"]); |
|
2099 | 2099 | if ($vertAlign == 'superscript') { |
2100 | 2100 | $objText->getFont()->setSuperScript(true); |
2101 | 2101 | } |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) { |
2107 | 2107 | $objText->getFont()->setUnderline(\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE); |
2108 | 2108 | } elseif (isset($run->rPr->u) && isset($run->rPr->u["val"])) { |
2109 | - $objText->getFont()->setUnderline((string)$run->rPr->u["val"]); |
|
2109 | + $objText->getFont()->setUnderline((string) $run->rPr->u["val"]); |
|
2110 | 2110 | } |
2111 | 2111 | if ((isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"])) || |
2112 | 2112 | (isset($run->rPr->strike) && !isset($run->rPr->strike["val"]))) { |
@@ -2143,8 +2143,8 @@ discard block |
||
2143 | 2143 | foreach ($UIRels->Relationship as $ele) { |
2144 | 2144 | if ($ele["Type"] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') { |
2145 | 2145 | // an image ? |
2146 | - $customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target']; |
|
2147 | - $customUIImagesBinaries[(string)$ele['Target']] = $this->getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); |
|
2146 | + $customUIImagesNames[(string) $ele['Id']] = (string) $ele['Target']; |
|
2147 | + $customUIImagesBinaries[(string) $ele['Target']] = $this->getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']); |
|
2148 | 2148 | } |
2149 | 2149 | } |
2150 | 2150 | } |
@@ -2174,7 +2174,7 @@ discard block |
||
2174 | 2174 | |
2175 | 2175 | private static function toCSSArray($style) |
2176 | 2176 | { |
2177 | - $style = str_replace(array("\r","\n"), "", $style); |
|
2177 | + $style = str_replace(array("\r", "\n"), "", $style); |
|
2178 | 2178 | |
2179 | 2179 | $temp = explode(';', $style); |
2180 | 2180 | $style = array(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function __construct() |
49 | 49 | { |
50 | - $this->readFilter = new DefaultReadFilter(); |
|
50 | + $this->readFilter = new DefaultReadFilter(); |
|
51 | 51 | $this->referenceHelper = \PhpSpreadsheet\ReferenceHelper::getInstance(); |
52 | 52 | } |
53 | 53 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $data = fread($fh, 2); |
76 | 76 | fclose($fh); |
77 | 77 | |
78 | - if ($data != chr(0x1F).chr(0x8B)) { |
|
78 | + if ($data != chr(0x1F) . chr(0x8B)) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | $xml = new XMLReader(); |
99 | - $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, \PhpSpreadsheet\Settings::getLibXmlLoaderOptions()); |
|
99 | + $xml->xml($this->securityScanFile('compress.zlib://' . realpath($pFilename)), null, \PhpSpreadsheet\Settings::getLibXmlLoaderOptions()); |
|
100 | 100 | $xml->setParserProperty(2, true); |
101 | 101 | |
102 | 102 | $worksheetNames = array(); |
103 | 103 | while ($xml->read()) { |
104 | 104 | if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) { |
105 | - $xml->read(); // Move onto the value node |
|
105 | + $xml->read(); // Move onto the value node |
|
106 | 106 | $worksheetNames[] = (string) $xml->value; |
107 | 107 | } elseif ($xml->name == 'gnm:Sheets') { |
108 | 108 | // break out of the loop once we've got our sheet names rather than parse the entire file |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $xml = new XMLReader(); |
130 | - $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, \PhpSpreadsheet\Settings::getLibXmlLoaderOptions()); |
|
130 | + $xml->xml($this->securityScanFile('compress.zlib://' . realpath($pFilename)), null, \PhpSpreadsheet\Settings::getLibXmlLoaderOptions()); |
|
131 | 131 | $xml->setParserProperty(2, true); |
132 | 132 | |
133 | 133 | $worksheetInfo = array(); |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | |
144 | 144 | while ($xml->read()) { |
145 | 145 | if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) { |
146 | - $xml->read(); // Move onto the value node |
|
146 | + $xml->read(); // Move onto the value node |
|
147 | 147 | $tmpInfo['worksheetName'] = (string) $xml->value; |
148 | 148 | } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) { |
149 | - $xml->read(); // Move onto the value node |
|
149 | + $xml->read(); // Move onto the value node |
|
150 | 150 | $tmpInfo['lastColumnIndex'] = (int) $xml->value; |
151 | 151 | $tmpInfo['totalColumns'] = (int) $xml->value + 1; |
152 | 152 | } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) { |
153 | - $xml->read(); // Move onto the value node |
|
153 | + $xml->read(); // Move onto the value node |
|
154 | 154 | $tmpInfo['totalRows'] = (int) $xml->value + 1; |
155 | 155 | break; |
156 | 156 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | if (isset($sheet->PrintInformation->Margins)) { |
349 | 349 | foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) { |
350 | 350 | $marginAttributes = $margin->attributes(); |
351 | - $marginSize = 72 / 100; // Default |
|
351 | + $marginSize = 72 / 100; // Default |
|
352 | 352 | switch ($marginAttributes['PrefUnit']) { |
353 | 353 | case 'mm': |
354 | 354 | $marginSize = intval($marginAttributes['Points']) / 100; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | break; |
435 | 435 | case '20': // Boolean |
436 | 436 | $type = \PhpSpreadsheet\Cell\DataType::TYPE_BOOL; |
437 | - $cell = ($cell == 'TRUE') ? true: false; |
|
437 | + $cell = ($cell == 'TRUE') ? true : false; |
|
438 | 438 | break; |
439 | 439 | case '30': // Integer |
440 | 440 | $cell = intval($cell); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | case '80': // Array |
453 | 453 | } |
454 | 454 | } |
455 | - $spreadsheet->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type); |
|
455 | + $spreadsheet->getActiveSheet()->getCell($column . $row)->setValueExplicit($cell, $type); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | if ((!$this->readDataOnly) && (isset($sheet->Objects))) { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $commentAttributes = $comment->attributes(); |
461 | 461 | // Only comment objects are handled at the moment |
462 | 462 | if ($commentAttributes->Text) { |
463 | - $spreadsheet->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->parseRichText((string)$commentAttributes->Text)); |
|
463 | + $spreadsheet->getActiveSheet()->getComment((string) $commentAttributes->ObjectBound)->setAuthor((string) $commentAttributes->Author)->setText($this->parseRichText((string) $commentAttributes->Text)); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $endColumn = \PhpSpreadsheet\Cell::stringFromColumnIndex($endColumn); |
478 | 478 | $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow']; |
479 | 479 | $endRow += 1; |
480 | - $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow; |
|
480 | + $cellRange = $startColumn . $startRow . ':' . $endColumn . $endRow; |
|
481 | 481 | // echo $cellRange,'<br />'; |
482 | 482 | |
483 | 483 | $styleAttributes = $styleRegion->Style->attributes(); |
@@ -677,19 +677,19 @@ discard block |
||
677 | 677 | if ((!$this->readDataOnly) && (isset($sheet->Cols))) { |
678 | 678 | // Column Widths |
679 | 679 | $columnAttributes = $sheet->Cols->attributes(); |
680 | - $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; |
|
680 | + $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4; |
|
681 | 681 | $c = 0; |
682 | 682 | foreach ($sheet->Cols->ColInfo as $columnOverride) { |
683 | 683 | $columnAttributes = $columnOverride->attributes(); |
684 | 684 | $column = $columnAttributes['No']; |
685 | - $columnWidth = $columnAttributes['Unit'] / 5.4; |
|
685 | + $columnWidth = $columnAttributes['Unit'] / 5.4; |
|
686 | 686 | $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false; |
687 | 687 | $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1; |
688 | 688 | while ($c < $column) { |
689 | 689 | $spreadsheet->getActiveSheet()->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($c))->setWidth($defaultWidth); |
690 | 690 | ++$c; |
691 | 691 | } |
692 | - while (($c < ($column+$columnCount)) && ($c <= $maxCol)) { |
|
692 | + while (($c < ($column + $columnCount)) && ($c <= $maxCol)) { |
|
693 | 693 | $spreadsheet->getActiveSheet()->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($c))->setWidth($columnWidth); |
694 | 694 | if ($hidden) { |
695 | 695 | $spreadsheet->getActiveSheet()->getColumnDimension(\PhpSpreadsheet\Cell::stringFromColumnIndex($c))->setVisible(false); |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | ++$r; |
720 | 720 | $spreadsheet->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight); |
721 | 721 | } |
722 | - while (($r < ($row+$rowCount)) && ($r < $maxRow)) { |
|
722 | + while (($r < ($row + $rowCount)) && ($r < $maxRow)) { |
|
723 | 723 | ++$r; |
724 | 724 | $spreadsheet->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight); |
725 | 725 | if ($hidden) { |
@@ -47,9 +47,9 @@ |
||
47 | 47 | private static function readColor($color, $background = false) |
48 | 48 | { |
49 | 49 | if (isset($color["rgb"])) { |
50 | - return (string)$color["rgb"]; |
|
50 | + return (string) $color["rgb"]; |
|
51 | 51 | } elseif (isset($color["indexed"])) { |
52 | - return \PhpSpreadsheet\Style\Color::indexedColor($color["indexed"]-7, $background)->getARGB(); |
|
52 | + return \PhpSpreadsheet\Style\Color::indexedColor($color["indexed"] - 7, $background)->getARGB(); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | } |
219 | 219 | $spreadsheet->setActiveSheetIndex($this->sheetIndex); |
220 | 220 | |
221 | - $fromFormats = array('\-', '\ '); |
|
222 | - $toFormats = array('-', ' '); |
|
221 | + $fromFormats = array('\-', '\ '); |
|
222 | + $toFormats = array('-', ' '); |
|
223 | 223 | |
224 | 224 | // Loop through file |
225 | 225 | $rowData = array(); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | break; |
253 | 253 | case 'S': |
254 | 254 | $styleSettings = substr($rowDatum, 1); |
255 | - for ($i=0; $i<strlen($styleSettings); ++$i) { |
|
255 | + for ($i = 0; $i < strlen($styleSettings); ++$i) { |
|
256 | 256 | switch ($styleSettings{$i}) { |
257 | 257 | case 'I': |
258 | 258 | $formatArray['font']['italic'] = true; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | break; |
278 | 278 | } |
279 | 279 | } |
280 | - $this->formats['P'.$this->format++] = $formatArray; |
|
280 | + $this->formats['P' . $this->format++] = $formatArray; |
|
281 | 281 | // Read cell value data |
282 | 282 | } elseif ($dataType == 'C') { |
283 | 283 | $hasCalculatedValue = false; |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | $cellData = substr($rowDatum, 1); |
297 | 297 | break; |
298 | 298 | case 'E': |
299 | - $cellDataFormula = '='.substr($rowDatum, 1); |
|
299 | + $cellDataFormula = '=' . substr($rowDatum, 1); |
|
300 | 300 | // Convert R1C1 style references to A1 style references (but only when not quoted) |
301 | 301 | $temp = explode('"', $cellDataFormula); |
302 | 302 | $key = false; |
303 | 303 | foreach ($temp as &$value) { |
304 | 304 | // Only count/replace in alternate array entries |
305 | 305 | if ($key = !$key) { |
306 | - preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER+PREG_OFFSET_CAPTURE); |
|
306 | + preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE); |
|
307 | 307 | // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way |
308 | 308 | // through the formula from left to right. Reversing means that we work right to left.through |
309 | 309 | // the formula |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | if ($columnReference{0} == '[') { |
330 | 330 | $columnReference = $column + trim($columnReference, '[]'); |
331 | 331 | } |
332 | - $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
332 | + $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference; |
|
333 | 333 | |
334 | 334 | $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
335 | 335 | } |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | break; |
343 | 343 | } |
344 | 344 | } |
345 | - $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column-1); |
|
345 | + $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1); |
|
346 | 346 | $cellData = \PhpSpreadsheet\Calculation::unwrapResult($cellData); |
347 | 347 | |
348 | 348 | // Set cell value |
349 | - $spreadsheet->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); |
|
349 | + $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData); |
|
350 | 350 | if ($hasCalculatedValue) { |
351 | 351 | $cellData = \PhpSpreadsheet\Calculation::unwrapResult($cellData); |
352 | - $spreadsheet->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData); |
|
352 | + $spreadsheet->getActiveSheet()->getCell($columnLetter . $row)->setCalculatedValue($cellData); |
|
353 | 353 | } |
354 | 354 | // Read cell formatting |
355 | 355 | } elseif ($dataType == 'F') { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | break; |
374 | 374 | case 'S': |
375 | 375 | $styleSettings = substr($rowDatum, 1); |
376 | - for ($i=0; $i<strlen($styleSettings); ++$i) { |
|
376 | + for ($i = 0; $i < strlen($styleSettings); ++$i) { |
|
377 | 377 | switch ($styleSettings{$i}) { |
378 | 378 | case 'I': |
379 | 379 | $styleData['font']['italic'] = true; |
@@ -399,22 +399,22 @@ discard block |
||
399 | 399 | } |
400 | 400 | } |
401 | 401 | if (($formatStyle > '') && ($column > '') && ($row > '')) { |
402 | - $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column-1); |
|
402 | + $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1); |
|
403 | 403 | if (isset($this->formats[$formatStyle])) { |
404 | - $spreadsheet->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]); |
|
404 | + $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($this->formats[$formatStyle]); |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | if ((!empty($styleData)) && ($column > '') && ($row > '')) { |
408 | - $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column-1); |
|
409 | - $spreadsheet->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData); |
|
408 | + $columnLetter = \PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1); |
|
409 | + $spreadsheet->getActiveSheet()->getStyle($columnLetter . $row)->applyFromArray($styleData); |
|
410 | 410 | } |
411 | 411 | if ($columnWidth > '') { |
412 | 412 | if ($startCol == $endCol) { |
413 | - $startCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($startCol-1); |
|
413 | + $startCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($startCol - 1); |
|
414 | 414 | $spreadsheet->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); |
415 | 415 | } else { |
416 | - $startCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($startCol-1); |
|
417 | - $endCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($endCol-1); |
|
416 | + $startCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($startCol - 1); |
|
417 | + $endCol = \PhpSpreadsheet\Cell::stringFromColumnIndex($endCol - 1); |
|
418 | 418 | $spreadsheet->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth); |
419 | 419 | do { |
420 | 420 | $spreadsheet->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct() |
40 | 40 | { |
41 | - $this->readFilter = new DefaultReadFilter(); |
|
41 | + $this->readFilter = new DefaultReadFilter(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $xml = new XMLReader(); |
124 | 124 | $res = $xml->xml( |
125 | - $this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), |
|
125 | + $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'), |
|
126 | 126 | null, |
127 | 127 | \PhpSpreadsheet\Settings::getLibXmlLoaderOptions() |
128 | 128 | ); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | $xml = new XMLReader(); |
180 | 180 | $res = $xml->xml( |
181 | - $this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), |
|
181 | + $this->securityScanFile('zip://' . realpath($pFilename) . '#content.xml'), |
|
182 | 182 | null, |
183 | 183 | \PhpSpreadsheet\Settings::getLibXmlLoaderOptions() |
184 | 184 | ); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | foreach ($annotationText as $t) { |
516 | 516 | if (isset($t->span)) { |
517 | 517 | foreach ($t->span as $text) { |
518 | - $textArray[] = (string)$text; |
|
518 | + $textArray[] = (string) $text; |
|
519 | 519 | } |
520 | 520 | } else { |
521 | 521 | $textArray[] = (string) $t; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | } |
524 | 524 | $text = implode("\n", $textArray); |
525 | 525 | // echo $text, '<br />'; |
526 | - $spreadsheet->getActiveSheet()->getComment($columnID.$rowID)->setText($this->parseRichText($text)); |
|
526 | + $spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setText($this->parseRichText($text)); |
|
527 | 527 | // ->setAuthor( $author ) |
528 | 528 | } |
529 | 529 | |
@@ -597,14 +597,14 @@ discard block |
||
597 | 597 | list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s')); |
598 | 598 | $dataValue = \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day, $hour, $minute, $second); |
599 | 599 | if ($dataValue != floor($dataValue)) { |
600 | - $formatting = \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15.' '.\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4; |
|
600 | + $formatting = \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15 . ' ' . \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4; |
|
601 | 601 | } else { |
602 | 602 | $formatting = \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_XLSX15; |
603 | 603 | } |
604 | 604 | break; |
605 | 605 | case 'time': |
606 | 606 | $type = \PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC; |
607 | - $dataValue = \PhpSpreadsheet\Shared\Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS')))); |
|
607 | + $dataValue = \PhpSpreadsheet\Shared\Date::PHPToExcel(strtotime('01-01-1970 ' . implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS')))); |
|
608 | 608 | $formatting = \PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME4; |
609 | 609 | break; |
610 | 610 | } |
@@ -620,16 +620,16 @@ discard block |
||
620 | 620 | if ($hasCalculatedValue) { |
621 | 621 | $type = \PhpSpreadsheet\Cell\DataType::TYPE_FORMULA; |
622 | 622 | // echo 'Formula: ', $cellDataFormula, PHP_EOL; |
623 | - $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1); |
|
623 | + $cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=') + 1); |
|
624 | 624 | $temp = explode('"', $cellDataFormula); |
625 | 625 | $tKey = false; |
626 | 626 | foreach ($temp as &$value) { |
627 | 627 | // Only replace in alternate array entries (i.e. non-quoted blocks) |
628 | 628 | if ($tKey = !$tKey) { |
629 | - $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet |
|
630 | - $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet |
|
631 | - $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference |
|
632 | - $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference |
|
629 | + $value = preg_replace('/\[([^\.]+)\.([^\.]+):\.([^\.]+)\]/Ui', '$1!$2:$3', $value); // Cell range reference in another sheet |
|
630 | + $value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet |
|
631 | + $value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference |
|
632 | + $value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference |
|
633 | 633 | $value = \PhpSpreadsheet\Calculation::translateSeparator(';', ',', $value, $inBraces); |
634 | 634 | } |
635 | 635 | } |
@@ -648,18 +648,18 @@ discard block |
||
648 | 648 | if ($type !== \PhpSpreadsheet\Cell\DataType::TYPE_NULL) { |
649 | 649 | for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) { |
650 | 650 | $rID = $rowID + $rowAdjust; |
651 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type); |
|
651 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type); |
|
652 | 652 | if ($hasCalculatedValue) { |
653 | 653 | // echo 'Forumla result is '.$dataValue.'<br />'; |
654 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->setCalculatedValue($dataValue); |
|
654 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->setCalculatedValue($dataValue); |
|
655 | 655 | } |
656 | 656 | if ($formatting !== null) { |
657 | - $spreadsheet->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting); |
|
657 | + $spreadsheet->getActiveSheet()->getStyle($columnID . $rID)->getNumberFormat()->setFormatCode($formatting); |
|
658 | 658 | } else { |
659 | - $spreadsheet->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_GENERAL); |
|
659 | + $spreadsheet->getActiveSheet()->getStyle($columnID . $rID)->getNumberFormat()->setFormatCode(\PhpSpreadsheet\Style\NumberFormat::FORMAT_GENERAL); |
|
660 | 660 | } |
661 | 661 | if ($hyperlink !== null) { |
662 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink); |
|
662 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rID)->getHyperlink()->setUrl($hyperlink); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -671,13 +671,13 @@ discard block |
||
671 | 671 | if (($type !== \PhpSpreadsheet\Cell\DataType::TYPE_NULL) || (!$this->readDataOnly)) { |
672 | 672 | $columnTo = $columnID; |
673 | 673 | if (isset($cellDataTableAttributes['number-columns-spanned'])) { |
674 | - $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2); |
|
674 | + $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] - 2); |
|
675 | 675 | } |
676 | 676 | $rowTo = $rowID; |
677 | 677 | if (isset($cellDataTableAttributes['number-rows-spanned'])) { |
678 | 678 | $rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1; |
679 | 679 | } |
680 | - $cellRange = $columnID.$rowID.':'.$columnTo.$rowTo; |
|
680 | + $cellRange = $columnID . $rowID . ':' . $columnTo . $rowTo; |
|
681 | 681 | $spreadsheet->getActiveSheet()->mergeCells($cellRange); |
682 | 682 | } |
683 | 683 | } |
@@ -285,20 +285,20 @@ discard block |
||
285 | 285 | $fromFormats = array('\-', '\ '); |
286 | 286 | $toFormats = array('-', ' '); |
287 | 287 | |
288 | - $underlineStyles = array ( |
|
288 | + $underlineStyles = array( |
|
289 | 289 | \PhpSpreadsheet\Style\Font::UNDERLINE_NONE, |
290 | 290 | \PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, |
291 | 291 | \PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLEACCOUNTING, |
292 | 292 | \PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE, |
293 | 293 | \PhpSpreadsheet\Style\Font::UNDERLINE_SINGLEACCOUNTING |
294 | 294 | ); |
295 | - $verticalAlignmentStyles = array ( |
|
295 | + $verticalAlignmentStyles = array( |
|
296 | 296 | \PhpSpreadsheet\Style\Alignment::VERTICAL_BOTTOM, |
297 | 297 | \PhpSpreadsheet\Style\Alignment::VERTICAL_TOP, |
298 | 298 | \PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, |
299 | 299 | \PhpSpreadsheet\Style\Alignment::VERTICAL_JUSTIFY |
300 | 300 | ); |
301 | - $horizontalAlignmentStyles = array ( |
|
301 | + $horizontalAlignmentStyles = array( |
|
302 | 302 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_GENERAL, |
303 | 303 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT, |
304 | 304 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT, |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | foreach ($worksheet->Table->Column as $columnData) { |
553 | 553 | $columnData_ss = $columnData->attributes($namespaces['ss']); |
554 | 554 | if (isset($columnData_ss['Index'])) { |
555 | - $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnData_ss['Index']-1); |
|
555 | + $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnData_ss['Index'] - 1); |
|
556 | 556 | } |
557 | 557 | if (isset($columnData_ss['Width'])) { |
558 | 558 | $columnWidth = $columnData_ss['Width']; |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | foreach ($rowData->Cell as $cell) { |
579 | 579 | $cell_ss = $cell->attributes($namespaces['ss']); |
580 | 580 | if (isset($cell_ss['Index'])) { |
581 | - $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($cell_ss['Index']-1); |
|
581 | + $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($cell_ss['Index'] - 1); |
|
582 | 582 | } |
583 | - $cellRange = $columnID.$rowID; |
|
583 | + $cellRange = $columnID . $rowID; |
|
584 | 584 | |
585 | 585 | if ($this->getReadFilter() !== null) { |
586 | 586 | if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
@@ -591,14 +591,14 @@ discard block |
||
591 | 591 | if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { |
592 | 592 | $columnTo = $columnID; |
593 | 593 | if (isset($cell_ss['MergeAcross'])) { |
594 | - $additionalMergedCells += (int)$cell_ss['MergeAcross']; |
|
595 | - $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); |
|
594 | + $additionalMergedCells += (int) $cell_ss['MergeAcross']; |
|
595 | + $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] - 1); |
|
596 | 596 | } |
597 | 597 | $rowTo = $rowID; |
598 | 598 | if (isset($cell_ss['MergeDown'])) { |
599 | 599 | $rowTo = $rowTo + $cell_ss['MergeDown']; |
600 | 600 | } |
601 | - $cellRange .= ':'.$columnTo.$rowTo; |
|
601 | + $cellRange .= ':' . $columnTo . $rowTo; |
|
602 | 602 | $spreadsheet->getActiveSheet()->mergeCells($cellRange); |
603 | 603 | } |
604 | 604 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | if ($columnReference{0} == '[') { |
704 | 704 | $columnReference = $columnNumber + trim($columnReference, '[]'); |
705 | 705 | } |
706 | - $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
706 | + $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference; |
|
707 | 707 | $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
708 | 708 | } |
709 | 709 | } |
@@ -717,10 +717,10 @@ discard block |
||
717 | 717 | |
718 | 718 | // echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />'; |
719 | 719 | // |
720 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
720 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
721 | 721 | if ($hasCalculatedValue) { |
722 | 722 | // echo 'Formula result is '.$cellValue.'<br />'; |
723 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue); |
|
723 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setCalculatedValue($cellValue); |
|
724 | 724 | } |
725 | 725 | $cellIsSet = $rowHasData = true; |
726 | 726 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $commentAttributes = $cell->Comment->attributes($namespaces['ss']); |
731 | 731 | $author = 'unknown'; |
732 | 732 | if (isset($commentAttributes->Author)) { |
733 | - $author = (string)$commentAttributes->Author; |
|
733 | + $author = (string) $commentAttributes->Author; |
|
734 | 734 | // echo 'Author: ', $author,'<br />'; |
735 | 735 | } |
736 | 736 | $node = $cell->Comment->Data->asXML(); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // echo $annotation,'<br />'; |
739 | 739 | $annotation = strip_tags($node); |
740 | 740 | // echo 'Annotation: ', $annotation,'<br />'; |
741 | - $spreadsheet->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation)); |
|
741 | + $spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation)); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | if (($cellIsSet) && (isset($cell_ss['StyleID']))) { |
@@ -748,8 +748,8 @@ discard block |
||
748 | 748 | // echo 'Cell '.$columnID.$rowID.'<br />'; |
749 | 749 | // print_r($this->styles[$style]); |
750 | 750 | // echo '<br />'; |
751 | - if (!$spreadsheet->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
752 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setValue(null); |
|
751 | + if (!$spreadsheet->getActiveSheet()->cellExists($columnID . $rowID)) { |
|
752 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValue(null); |
|
753 | 753 | } |
754 | 754 | $spreadsheet->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]); |
755 | 755 | } |