@@ -357,61 +357,61 @@ |
||
357 | 357 | // Indexed colors |
358 | 358 | if (is_null(self::$indexedColors)) { |
359 | 359 | self::$indexedColors = [ |
360 | - 1 => 'FF000000', // System Colour #1 - Black |
|
361 | - 2 => 'FFFFFFFF', // System Colour #2 - White |
|
362 | - 3 => 'FFFF0000', // System Colour #3 - Red |
|
363 | - 4 => 'FF00FF00', // System Colour #4 - Green |
|
364 | - 5 => 'FF0000FF', // System Colour #5 - Blue |
|
365 | - 6 => 'FFFFFF00', // System Colour #6 - Yellow |
|
366 | - 7 => 'FFFF00FF', // System Colour #7- Magenta |
|
367 | - 8 => 'FF00FFFF', // System Colour #8- Cyan |
|
368 | - 9 => 'FF800000', // Standard Colour #9 |
|
369 | - 10 => 'FF008000', // Standard Colour #10 |
|
370 | - 11 => 'FF000080', // Standard Colour #11 |
|
371 | - 12 => 'FF808000', // Standard Colour #12 |
|
372 | - 13 => 'FF800080', // Standard Colour #13 |
|
373 | - 14 => 'FF008080', // Standard Colour #14 |
|
374 | - 15 => 'FFC0C0C0', // Standard Colour #15 |
|
375 | - 16 => 'FF808080', // Standard Colour #16 |
|
376 | - 17 => 'FF9999FF', // Chart Fill Colour #17 |
|
377 | - 18 => 'FF993366', // Chart Fill Colour #18 |
|
378 | - 19 => 'FFFFFFCC', // Chart Fill Colour #19 |
|
379 | - 20 => 'FFCCFFFF', // Chart Fill Colour #20 |
|
380 | - 21 => 'FF660066', // Chart Fill Colour #21 |
|
381 | - 22 => 'FFFF8080', // Chart Fill Colour #22 |
|
382 | - 23 => 'FF0066CC', // Chart Fill Colour #23 |
|
383 | - 24 => 'FFCCCCFF', // Chart Fill Colour #24 |
|
384 | - 25 => 'FF000080', // Chart Line Colour #25 |
|
385 | - 26 => 'FFFF00FF', // Chart Line Colour #26 |
|
386 | - 27 => 'FFFFFF00', // Chart Line Colour #27 |
|
387 | - 28 => 'FF00FFFF', // Chart Line Colour #28 |
|
388 | - 29 => 'FF800080', // Chart Line Colour #29 |
|
389 | - 30 => 'FF800000', // Chart Line Colour #30 |
|
390 | - 31 => 'FF008080', // Chart Line Colour #31 |
|
391 | - 32 => 'FF0000FF', // Chart Line Colour #32 |
|
392 | - 33 => 'FF00CCFF', // Standard Colour #33 |
|
393 | - 34 => 'FFCCFFFF', // Standard Colour #34 |
|
394 | - 35 => 'FFCCFFCC', // Standard Colour #35 |
|
395 | - 36 => 'FFFFFF99', // Standard Colour #36 |
|
396 | - 37 => 'FF99CCFF', // Standard Colour #37 |
|
397 | - 38 => 'FFFF99CC', // Standard Colour #38 |
|
398 | - 39 => 'FFCC99FF', // Standard Colour #39 |
|
399 | - 40 => 'FFFFCC99', // Standard Colour #40 |
|
400 | - 41 => 'FF3366FF', // Standard Colour #41 |
|
401 | - 42 => 'FF33CCCC', // Standard Colour #42 |
|
402 | - 43 => 'FF99CC00', // Standard Colour #43 |
|
403 | - 44 => 'FFFFCC00', // Standard Colour #44 |
|
404 | - 45 => 'FFFF9900', // Standard Colour #45 |
|
405 | - 46 => 'FFFF6600', // Standard Colour #46 |
|
406 | - 47 => 'FF666699', // Standard Colour #47 |
|
407 | - 48 => 'FF969696', // Standard Colour #48 |
|
408 | - 49 => 'FF003366', // Standard Colour #49 |
|
409 | - 50 => 'FF339966', // Standard Colour #50 |
|
410 | - 51 => 'FF003300', // Standard Colour #51 |
|
411 | - 52 => 'FF333300', // Standard Colour #52 |
|
412 | - 53 => 'FF993300', // Standard Colour #53 |
|
413 | - 54 => 'FF993366', // Standard Colour #54 |
|
414 | - 55 => 'FF333399', // Standard Colour #55 |
|
360 | + 1 => 'FF000000', // System Colour #1 - Black |
|
361 | + 2 => 'FFFFFFFF', // System Colour #2 - White |
|
362 | + 3 => 'FFFF0000', // System Colour #3 - Red |
|
363 | + 4 => 'FF00FF00', // System Colour #4 - Green |
|
364 | + 5 => 'FF0000FF', // System Colour #5 - Blue |
|
365 | + 6 => 'FFFFFF00', // System Colour #6 - Yellow |
|
366 | + 7 => 'FFFF00FF', // System Colour #7- Magenta |
|
367 | + 8 => 'FF00FFFF', // System Colour #8- Cyan |
|
368 | + 9 => 'FF800000', // Standard Colour #9 |
|
369 | + 10 => 'FF008000', // Standard Colour #10 |
|
370 | + 11 => 'FF000080', // Standard Colour #11 |
|
371 | + 12 => 'FF808000', // Standard Colour #12 |
|
372 | + 13 => 'FF800080', // Standard Colour #13 |
|
373 | + 14 => 'FF008080', // Standard Colour #14 |
|
374 | + 15 => 'FFC0C0C0', // Standard Colour #15 |
|
375 | + 16 => 'FF808080', // Standard Colour #16 |
|
376 | + 17 => 'FF9999FF', // Chart Fill Colour #17 |
|
377 | + 18 => 'FF993366', // Chart Fill Colour #18 |
|
378 | + 19 => 'FFFFFFCC', // Chart Fill Colour #19 |
|
379 | + 20 => 'FFCCFFFF', // Chart Fill Colour #20 |
|
380 | + 21 => 'FF660066', // Chart Fill Colour #21 |
|
381 | + 22 => 'FFFF8080', // Chart Fill Colour #22 |
|
382 | + 23 => 'FF0066CC', // Chart Fill Colour #23 |
|
383 | + 24 => 'FFCCCCFF', // Chart Fill Colour #24 |
|
384 | + 25 => 'FF000080', // Chart Line Colour #25 |
|
385 | + 26 => 'FFFF00FF', // Chart Line Colour #26 |
|
386 | + 27 => 'FFFFFF00', // Chart Line Colour #27 |
|
387 | + 28 => 'FF00FFFF', // Chart Line Colour #28 |
|
388 | + 29 => 'FF800080', // Chart Line Colour #29 |
|
389 | + 30 => 'FF800000', // Chart Line Colour #30 |
|
390 | + 31 => 'FF008080', // Chart Line Colour #31 |
|
391 | + 32 => 'FF0000FF', // Chart Line Colour #32 |
|
392 | + 33 => 'FF00CCFF', // Standard Colour #33 |
|
393 | + 34 => 'FFCCFFFF', // Standard Colour #34 |
|
394 | + 35 => 'FFCCFFCC', // Standard Colour #35 |
|
395 | + 36 => 'FFFFFF99', // Standard Colour #36 |
|
396 | + 37 => 'FF99CCFF', // Standard Colour #37 |
|
397 | + 38 => 'FFFF99CC', // Standard Colour #38 |
|
398 | + 39 => 'FFCC99FF', // Standard Colour #39 |
|
399 | + 40 => 'FFFFCC99', // Standard Colour #40 |
|
400 | + 41 => 'FF3366FF', // Standard Colour #41 |
|
401 | + 42 => 'FF33CCCC', // Standard Colour #42 |
|
402 | + 43 => 'FF99CC00', // Standard Colour #43 |
|
403 | + 44 => 'FFFFCC00', // Standard Colour #44 |
|
404 | + 45 => 'FFFF9900', // Standard Colour #45 |
|
405 | + 46 => 'FFFF6600', // Standard Colour #46 |
|
406 | + 47 => 'FF666699', // Standard Colour #47 |
|
407 | + 48 => 'FF969696', // Standard Colour #48 |
|
408 | + 49 => 'FF003366', // Standard Colour #49 |
|
409 | + 50 => 'FF339966', // Standard Colour #50 |
|
410 | + 51 => 'FF003300', // Standard Colour #51 |
|
411 | + 52 => 'FF333300', // Standard Colour #52 |
|
412 | + 53 => 'FF993300', // Standard Colour #53 |
|
413 | + 54 => 'FF993366', // Standard Colour #54 |
|
414 | + 55 => 'FF333399', // Standard Colour #55 |
|
415 | 415 | 56 => 'FF333333' // Standard Colour #56 |
416 | 416 | ]; |
417 | 417 | } |
@@ -169,8 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $aBreaks = $pSheet->getBreaks(); |
171 | 171 | ($pNumCols > 0 || $pNumRows > 0) ? |
172 | - uksort($aBreaks, array('self','cellReverseSort')) : |
|
173 | - uksort($aBreaks, array('self','cellSort')); |
|
172 | + uksort($aBreaks, array('self', 'cellReverseSort')) : uksort($aBreaks, array('self', 'cellSort')); |
|
174 | 173 | |
175 | 174 | foreach ($aBreaks as $key => $value) { |
176 | 175 | if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) { |
@@ -230,8 +229,7 @@ discard block |
||
230 | 229 | { |
231 | 230 | $aHyperlinkCollection = $pSheet->getHyperlinkCollection(); |
232 | 231 | ($pNumCols > 0 || $pNumRows > 0) ? |
233 | - uksort($aHyperlinkCollection, array('self','cellReverseSort')) : |
|
234 | - uksort($aHyperlinkCollection, array('self','cellSort')); |
|
232 | + uksort($aHyperlinkCollection, array('self', 'cellReverseSort')) : uksort($aHyperlinkCollection, array('self', 'cellSort')); |
|
235 | 233 | |
236 | 234 | foreach ($aHyperlinkCollection as $key => $value) { |
237 | 235 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
@@ -256,8 +254,7 @@ discard block |
||
256 | 254 | { |
257 | 255 | $aDataValidationCollection = $pSheet->getDataValidationCollection(); |
258 | 256 | ($pNumCols > 0 || $pNumRows > 0) ? |
259 | - uksort($aDataValidationCollection, array('self','cellReverseSort')) : |
|
260 | - uksort($aDataValidationCollection, array('self','cellSort')); |
|
257 | + uksort($aDataValidationCollection, array('self', 'cellReverseSort')) : uksort($aDataValidationCollection, array('self', 'cellSort')); |
|
261 | 258 | |
262 | 259 | foreach ($aDataValidationCollection as $key => $value) { |
263 | 260 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
@@ -303,8 +300,7 @@ discard block |
||
303 | 300 | { |
304 | 301 | $aProtectedCells = $pSheet->getProtectedCells(); |
305 | 302 | ($pNumCols > 0 || $pNumRows > 0) ? |
306 | - uksort($aProtectedCells, array('self','cellReverseSort')) : |
|
307 | - uksort($aProtectedCells, array('self','cellSort')); |
|
303 | + uksort($aProtectedCells, array('self', 'cellReverseSort')) : uksort($aProtectedCells, array('self', 'cellSort')); |
|
308 | 304 | foreach ($aProtectedCells as $key => $value) { |
309 | 305 | $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows); |
310 | 306 | if ($key != $newReference) { |
@@ -389,13 +385,13 @@ discard block |
||
389 | 385 | |
390 | 386 | // Get coordinates of $pBefore |
391 | 387 | $beforeColumn = 'A'; |
392 | - $beforeRow = 1; |
|
388 | + $beforeRow = 1; |
|
393 | 389 | list($beforeColumn, $beforeRow) = Cell::coordinateFromString($pBefore); |
394 | 390 | $beforeColumnIndex = Cell::columnIndexFromString($beforeColumn); |
395 | 391 | |
396 | 392 | // Clear cells if we are removing columns or rows |
397 | - $highestColumn = $pSheet->getHighestColumn(); |
|
398 | - $highestRow = $pSheet->getHighestRow(); |
|
393 | + $highestColumn = $pSheet->getHighestColumn(); |
|
394 | + $highestRow = $pSheet->getHighestRow(); |
|
399 | 395 | |
400 | 396 | // 1. Clear column strips if we are removing columns |
401 | 397 | if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { |
@@ -434,12 +430,12 @@ discard block |
||
434 | 430 | $cell = $pSheet->getCell($cellID); |
435 | 431 | $cellIndex = Cell::columnIndexFromString($cell->getColumn()); |
436 | 432 | |
437 | - if ($cellIndex-1 + $pNumCols < 0) { |
|
433 | + if ($cellIndex - 1 + $pNumCols < 0) { |
|
438 | 434 | continue; |
439 | 435 | } |
440 | 436 | |
441 | 437 | // New coordinates |
442 | - $newCoordinates = Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows); |
|
438 | + $newCoordinates = Cell::stringFromColumnIndex($cellIndex - 1 + $pNumCols) . ($cell->getRow() + $pNumRows); |
|
443 | 439 | |
444 | 440 | // Should the cell be updated? Move value and cellXf index from one cell to another. |
445 | 441 | if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) { |
@@ -469,8 +465,8 @@ discard block |
||
469 | 465 | } |
470 | 466 | |
471 | 467 | // Duplicate styles for the newly inserted cells |
472 | - $highestColumn = $pSheet->getHighestColumn(); |
|
473 | - $highestRow = $pSheet->getHighestRow(); |
|
468 | + $highestColumn = $pSheet->getHighestColumn(); |
|
469 | + $highestRow = $pSheet->getHighestRow(); |
|
474 | 470 | |
475 | 471 | if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) { |
476 | 472 | for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { |
@@ -568,23 +564,23 @@ discard block |
||
568 | 564 | // Shuffle columns in autofilter range |
569 | 565 | if ($pNumCols > 0) { |
570 | 566 | // For insert, we shuffle from end to beginning to avoid overwriting |
571 | - $startColID = Cell::stringFromColumnIndex($startCol-1); |
|
572 | - $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1); |
|
567 | + $startColID = Cell::stringFromColumnIndex($startCol - 1); |
|
568 | + $toColID = Cell::stringFromColumnIndex($startCol + $pNumCols - 1); |
|
573 | 569 | $endColID = Cell::stringFromColumnIndex($rangeEnd[0]); |
574 | 570 | |
575 | 571 | $startColRef = $startCol; |
576 | 572 | $endColRef = $rangeEnd[0]; |
577 | - $toColRef = $rangeEnd[0]+$pNumCols; |
|
573 | + $toColRef = $rangeEnd[0] + $pNumCols; |
|
578 | 574 | |
579 | 575 | do { |
580 | - $autoFilter->shiftColumn(Cell::stringFromColumnIndex($endColRef-1), Cell::stringFromColumnIndex($toColRef-1)); |
|
576 | + $autoFilter->shiftColumn(Cell::stringFromColumnIndex($endColRef - 1), Cell::stringFromColumnIndex($toColRef - 1)); |
|
581 | 577 | --$endColRef; |
582 | 578 | --$toColRef; |
583 | 579 | } while ($startColRef <= $endColRef); |
584 | 580 | } else { |
585 | 581 | // For delete, we shuffle from beginning to end to avoid overwriting |
586 | - $startColID = Cell::stringFromColumnIndex($startCol-1); |
|
587 | - $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1); |
|
582 | + $startColID = Cell::stringFromColumnIndex($startCol - 1); |
|
583 | + $toColID = Cell::stringFromColumnIndex($startCol + $pNumCols - 1); |
|
588 | 584 | $endColID = Cell::stringFromColumnIndex($rangeEnd[0]); |
589 | 585 | do { |
590 | 586 | $autoFilter->shiftColumn($startColID, $toColID); |
@@ -652,93 +648,93 @@ discard block |
||
652 | 648 | $adjustCount = 0; |
653 | 649 | $newCellTokens = $cellTokens = array(); |
654 | 650 | // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) |
655 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
651 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
656 | 652 | if ($matchCount > 0) { |
657 | 653 | foreach ($matches as $match) { |
658 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
659 | - $fromString .= $match[3].':'.$match[4]; |
|
660 | - $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
661 | - $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
654 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
655 | + $fromString .= $match[3] . ':' . $match[4]; |
|
656 | + $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
657 | + $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
662 | 658 | |
663 | - if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
659 | + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
664 | 660 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
665 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
666 | - $toString .= $modified3.':'.$modified4; |
|
661 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
662 | + $toString .= $modified3 . ':' . $modified4; |
|
667 | 663 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
668 | 664 | $column = 100000; |
669 | 665 | $row = 10000000 + trim($match[3], '$'); |
670 | - $cellIndex = $column.$row; |
|
666 | + $cellIndex = $column . $row; |
|
671 | 667 | |
672 | 668 | $newCellTokens[$cellIndex] = preg_quote($toString); |
673 | - $cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i'; |
|
669 | + $cellTokens[$cellIndex] = '/(?<!\d\$\!)' . preg_quote($fromString) . '(?!\d)/i'; |
|
674 | 670 | ++$adjustCount; |
675 | 671 | } |
676 | 672 | } |
677 | 673 | } |
678 | 674 | } |
679 | 675 | // Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E) |
680 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
676 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
681 | 677 | if ($matchCount > 0) { |
682 | 678 | foreach ($matches as $match) { |
683 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
684 | - $fromString .= $match[3].':'.$match[4]; |
|
685 | - $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
686 | - $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
679 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
680 | + $fromString .= $match[3] . ':' . $match[4]; |
|
681 | + $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
682 | + $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
687 | 683 | |
688 | - if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
684 | + if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
689 | 685 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
690 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
691 | - $toString .= $modified3.':'.$modified4; |
|
686 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
687 | + $toString .= $modified3 . ':' . $modified4; |
|
692 | 688 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
693 | 689 | $column = Cell::columnIndexFromString(trim($match[3], '$')) + 100000; |
694 | 690 | $row = 10000000; |
695 | - $cellIndex = $column.$row; |
|
691 | + $cellIndex = $column . $row; |
|
696 | 692 | |
697 | 693 | $newCellTokens[$cellIndex] = preg_quote($toString); |
698 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i'; |
|
694 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?![A-Z])/i'; |
|
699 | 695 | ++$adjustCount; |
700 | 696 | } |
701 | 697 | } |
702 | 698 | } |
703 | 699 | } |
704 | 700 | // Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5) |
705 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
701 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
706 | 702 | if ($matchCount > 0) { |
707 | 703 | foreach ($matches as $match) { |
708 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
709 | - $fromString .= $match[3].':'.$match[4]; |
|
704 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
705 | + $fromString .= $match[3] . ':' . $match[4]; |
|
710 | 706 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
711 | 707 | $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows); |
712 | 708 | |
713 | - if ($match[3].$match[4] !== $modified3.$modified4) { |
|
709 | + if ($match[3] . $match[4] !== $modified3 . $modified4) { |
|
714 | 710 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
715 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
716 | - $toString .= $modified3.':'.$modified4; |
|
711 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
712 | + $toString .= $modified3 . ':' . $modified4; |
|
717 | 713 | list($column, $row) = Cell::coordinateFromString($match[3]); |
718 | 714 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
719 | 715 | $column = Cell::columnIndexFromString(trim($column, '$')) + 100000; |
720 | 716 | $row = trim($row, '$') + 10000000; |
721 | - $cellIndex = $column.$row; |
|
717 | + $cellIndex = $column . $row; |
|
722 | 718 | |
723 | 719 | $newCellTokens[$cellIndex] = preg_quote($toString); |
724 | - $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i'; |
|
720 | + $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString) . '(?!\d)/i'; |
|
725 | 721 | ++$adjustCount; |
726 | 722 | } |
727 | 723 | } |
728 | 724 | } |
729 | 725 | } |
730 | 726 | // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) |
731 | - $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
727 | + $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
732 | 728 | |
733 | 729 | if ($matchCount > 0) { |
734 | 730 | foreach ($matches as $match) { |
735 | - $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
731 | + $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
736 | 732 | $fromString .= $match[3]; |
737 | 733 | |
738 | 734 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
739 | 735 | if ($match[3] !== $modified3) { |
740 | 736 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
741 | - $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
737 | + $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
742 | 738 | $toString .= $modified3; |
743 | 739 | list($column, $row) = Cell::coordinateFromString($match[3]); |
744 | 740 | // Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more |
@@ -747,7 +743,7 @@ discard block |
||
747 | 743 | $cellIndex = $row . $column; |
748 | 744 | |
749 | 745 | $newCellTokens[$cellIndex] = preg_quote($toString); |
750 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i'; |
|
746 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?!\d)/i'; |
|
751 | 747 | ++$adjustCount; |
752 | 748 | } |
753 | 749 | } |
@@ -847,10 +843,10 @@ discard block |
||
847 | 843 | $jc = count($range[$i]); |
848 | 844 | for ($j = 0; $j < $jc; ++$j) { |
849 | 845 | if (ctype_alpha($range[$i][$j])) { |
850 | - $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); |
|
846 | + $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $pBefore, $pNumCols, $pNumRows)); |
|
851 | 847 | $range[$i][$j] = $r[0]; |
852 | 848 | } elseif (ctype_digit($range[$i][$j])) { |
853 | - $r = Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
849 | + $r = Cell::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
854 | 850 | $range[$i][$j] = $r[1]; |
855 | 851 | } else { |
856 | 852 | $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); |
@@ -890,12 +886,12 @@ discard block |
||
890 | 886 | |
891 | 887 | // Create new column reference |
892 | 888 | if ($updateColumn) { |
893 | - $newColumn = Cell::stringFromColumnIndex(Cell::columnIndexFromString($newColumn) - 1 + $pNumCols); |
|
889 | + $newColumn = Cell::stringFromColumnIndex(Cell::columnIndexFromString($newColumn) - 1 + $pNumCols); |
|
894 | 890 | } |
895 | 891 | |
896 | 892 | // Create new row reference |
897 | 893 | if ($updateRow) { |
898 | - $newRow = $newRow + $pNumRows; |
|
894 | + $newRow = $newRow + $pNumRows; |
|
899 | 895 | } |
900 | 896 | |
901 | 897 | // Return new reference |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | return true; |
110 | 110 | } |
111 | 111 | // Check if the requested entry still exists in apc |
112 | - $success = apc_fetch($this->cachePrefix.$pCoord.'.cache'); |
|
112 | + $success = apc_fetch($this->cachePrefix . $pCoord . '.cache'); |
|
113 | 113 | if ($success === false) { |
114 | 114 | // Entry no longer exists in APC, so clear it from the cache array |
115 | 115 | parent::deleteCacheData($pCoord); |
116 | - throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |
|
116 | + throw new \PHPExcel\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache'); |
|
117 | 117 | } |
118 | 118 | return true; |
119 | 119 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if ($obj === false) { |
142 | 142 | // Entry no longer exists in APC, so clear it from the cache array |
143 | 143 | parent::deleteCacheData($pCoord); |
144 | - throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in APC cache'); |
|
144 | + throw new \PHPExcel\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache'); |
|
145 | 145 | } |
146 | 146 | } else { |
147 | 147 | // Return null if requested entry doesn't exist in cache |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function deleteCacheData($pCoord) |
183 | 183 | { |
184 | 184 | // Delete the entry from APC |
185 | - apc_delete($this->cachePrefix.$pCoord.'.cache'); |
|
185 | + apc_delete($this->cachePrefix . $pCoord . '.cache'); |
|
186 | 186 | |
187 | 187 | // Delete the entry from our cell address array |
188 | 188 | parent::deleteCacheData($pCoord); |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | return true; |
114 | 114 | } |
115 | 115 | // Check if the requested entry still exists in Memcache |
116 | - $success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache'); |
|
116 | + $success = $this->memcache->get($this->cachePrefix . $pCoord . '.cache'); |
|
117 | 117 | if ($success === false) { |
118 | 118 | // Entry no longer exists in Memcache, so clear it from the cache array |
119 | 119 | parent::deleteCacheData($pCoord); |
120 | - throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in MemCache'); |
|
120 | + throw new \PHPExcel\Exception('Cell entry ' . $pCoord . ' no longer exists in MemCache'); |
|
121 | 121 | } |
122 | 122 | return true; |
123 | 123 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $cacheList = $this->getCellList(); |
207 | 207 | foreach ($cacheList as $cellID) { |
208 | 208 | if ($cellID != $this->currentObjectID) { |
209 | - $obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache'); |
|
209 | + $obj = $this->memcache->get($this->cachePrefix . $cellID . '.cache'); |
|
210 | 210 | if ($obj === false) { |
211 | 211 | // Entry no longer exists in Memcache, so clear it from the cache array |
212 | 212 | parent::deleteCacheData($cellID); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $cacheList = $this->getCellList(); |
291 | 291 | foreach ($cacheList as $cellID) { |
292 | - $this->memcache->delete($this->cachePrefix.$cellID . '.cache'); |
|
292 | + $this->memcache->delete($this->cachePrefix . $cellID . '.cache'); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 |
@@ -196,7 +196,7 @@ |
||
196 | 196 | foreach ($this->getCellList() as $coord) { |
197 | 197 | sscanf($coord, '%[A-Z]%d', $c, $r); |
198 | 198 | $row[$r] = $r; |
199 | - $col[$c] = strlen($c).$c; |
|
199 | + $col[$c] = strlen($c) . $c; |
|
200 | 200 | } |
201 | 201 | if (!empty($row)) { |
202 | 202 | // Determine highest column and row |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | $this->currentObject->detach(); |
58 | 58 | |
59 | 59 | $obj = serialize($this->currentObject); |
60 | - if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) { |
|
61 | - if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { |
|
60 | + if (wincache_ucache_exists($this->cachePrefix . $this->currentObjectID . '.cache')) { |
|
61 | + if (!wincache_ucache_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) { |
|
62 | 62 | $this->__destruct(); |
63 | - throw new \PHPExcel\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); |
|
63 | + throw new \PHPExcel\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache'); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) { |
|
66 | + if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) { |
|
67 | 67 | $this->__destruct(); |
68 | - throw new \PHPExcel\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache'); |
|
68 | + throw new \PHPExcel\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache'); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | $this->currentCellIsDirty = false; |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | return true; |
112 | 112 | } |
113 | 113 | // Check if the requested entry still exists in cache |
114 | - $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache'); |
|
114 | + $success = wincache_ucache_exists($this->cachePrefix . $pCoord . '.cache'); |
|
115 | 115 | if ($success === false) { |
116 | 116 | // Entry no longer exists in Wincache, so clear it from the cache array |
117 | 117 | parent::deleteCacheData($pCoord); |
118 | - throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); |
|
118 | + throw new \PHPExcel\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache'); |
|
119 | 119 | } |
120 | 120 | return true; |
121 | 121 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | $obj = null; |
142 | 142 | if (parent::isDataSet($pCoord)) { |
143 | 143 | $success = false; |
144 | - $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success); |
|
144 | + $obj = wincache_ucache_get($this->cachePrefix . $pCoord . '.cache', $success); |
|
145 | 145 | if ($success === false) { |
146 | 146 | // Entry no longer exists in WinCache, so clear it from the cache array |
147 | 147 | parent::deleteCacheData($pCoord); |
148 | - throw new \PHPExcel\Exception('Cell entry '.$pCoord.' no longer exists in WinCache'); |
|
148 | + throw new \PHPExcel\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache'); |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | // Return null if requested entry doesn't exist in cache |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | public function deleteCacheData($pCoord) |
187 | 187 | { |
188 | 188 | // Delete the entry from Wincache |
189 | - wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache'); |
|
189 | + wincache_ucache_delete($this->cachePrefix . $pCoord . '.cache'); |
|
190 | 190 | |
191 | 191 | // Delete the entry from our cell address array |
192 | 192 | parent::deleteCacheData($pCoord); |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | foreach ($cacheList as $cellID) { |
209 | 209 | if ($cellID != $this->currentObjectID) { |
210 | 210 | $success = false; |
211 | - $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success); |
|
211 | + $obj = wincache_ucache_get($this->cachePrefix . $cellID . '.cache', $success); |
|
212 | 212 | if ($success === false) { |
213 | 213 | // Entry no longer exists in WinCache, so clear it from the cache array |
214 | 214 | parent::deleteCacheData($cellID); |
215 | - throw new \PHPExcel\Exception('Cell entry '.$cellID.' no longer exists in Wincache'); |
|
215 | + throw new \PHPExcel\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache'); |
|
216 | 216 | } |
217 | - if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) { |
|
217 | + if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) { |
|
218 | 218 | $this->__destruct(); |
219 | - throw new \PHPExcel\Exception('Failed to store cell '.$cellID.' in Wincache'); |
|
219 | + throw new \PHPExcel\Exception('Failed to store cell ' . $cellID . ' in Wincache'); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function __construct(\PHPExcel\Worksheet $parent, $arguments) |
255 | 255 | { |
256 | - $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; |
|
256 | + $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600; |
|
257 | 257 | |
258 | 258 | if (is_null($this->cachePrefix)) { |
259 | 259 | $baseUnique = $this->getUniqueID(); |
260 | - $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.'; |
|
260 | + $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.'; |
|
261 | 261 | $this->cacheTime = $cacheTime; |
262 | 262 | |
263 | 263 | parent::__construct($parent); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | { |
272 | 272 | $cacheList = $this->getCellList(); |
273 | 273 | foreach ($cacheList as $cellID) { |
274 | - wincache_ucache_delete($this->cachePrefix.$cellID.'.cache'); |
|
274 | + wincache_ucache_delete($this->cachePrefix . $cellID . '.cache'); |
|
275 | 275 | } |
276 | 276 | } |
277 | 277 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | parent::copyCellCollection($parent); |
150 | 150 | // Get a new id for the new file name |
151 | 151 | $baseUnique = $this->getUniqueID(); |
152 | - $newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; |
|
152 | + $newFileName = $this->cacheDirectory . '/PHPExcel.' . $baseUnique . '.cache'; |
|
153 | 153 | // Copy the existing cell cache file |
154 | 154 | copy($this->fileName, $newFileName); |
155 | 155 | $this->fileName = $newFileName; |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function __construct(\PHPExcel\Worksheet $parent, $arguments) |
186 | 186 | { |
187 | - $this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null)) |
|
187 | + $this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null)) |
|
188 | 188 | ? $arguments['dir'] |
189 | 189 | : \PHPExcel\Shared\File::sysGetTempDir(); |
190 | 190 | |
191 | 191 | parent::__construct($parent); |
192 | 192 | if (is_null($this->fileHandle)) { |
193 | 193 | $baseUnique = $this->getUniqueID(); |
194 | - $this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache'; |
|
194 | + $this->fileName = $this->cacheDirectory . '/PHPExcel.' . $baseUnique . '.cache'; |
|
195 | 195 | $this->fileHandle = fopen($this->fileName, 'a+'); |
196 | 196 | } |
197 | 197 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($this->currentCellIsDirty && !empty($this->currentObjectID)) { |
55 | 55 | $this->currentObject->detach(); |
56 | 56 | |
57 | - if (!$this->DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES('".$this->currentObjectID."','".sqlite_escape_string(serialize($this->currentObject))."')")) { |
|
57 | + if (!$this->DBHandle->queryExec("INSERT OR REPLACE INTO kvp_" . $this->TableName . " VALUES('" . $this->currentObjectID . "','" . sqlite_escape_string(serialize($this->currentObject)) . "')")) { |
|
58 | 58 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
59 | 59 | } |
60 | 60 | $this->currentCellIsDirty = false; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | $this->storeData(); |
99 | 99 | |
100 | - $query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; |
|
100 | + $query = "SELECT value FROM kvp_" . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
101 | 101 | $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); |
102 | 102 | if ($cellResultSet === false) { |
103 | 103 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // Check if the requested entry exists in the cache |
135 | - $query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; |
|
135 | + $query = "SELECT id FROM kvp_" . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
136 | 136 | $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC); |
137 | 137 | if ($cellResultSet === false) { |
138 | 138 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | // Check if the requested entry exists in the cache |
160 | - $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'"; |
|
160 | + $query = "DELETE FROM kvp_" . $this->TableName . " WHERE id='" . $pCoord . "'"; |
|
161 | 161 | if (!$this->DBHandle->queryExec($query)) { |
162 | 162 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
163 | 163 | } |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $this->currentObjectID = $toAddress; |
180 | 180 | } |
181 | 181 | |
182 | - $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'"; |
|
182 | + $query = "DELETE FROM kvp_" . $this->TableName . " WHERE id='" . $toAddress . "'"; |
|
183 | 183 | $result = $this->DBHandle->exec($query); |
184 | 184 | if ($result === false) { |
185 | 185 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
186 | 186 | } |
187 | 187 | |
188 | - $query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'"; |
|
188 | + $query = "UPDATE kvp_" . $this->TableName . " SET id='" . $toAddress . "' WHERE id='" . $fromAddress . "'"; |
|
189 | 189 | $result = $this->DBHandle->exec($query); |
190 | 190 | if ($result === false) { |
191 | 191 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $this->storeData(); |
207 | 207 | } |
208 | 208 | |
209 | - $query = "SELECT id FROM kvp_".$this->TableName; |
|
209 | + $query = "SELECT id FROM kvp_" . $this->TableName; |
|
210 | 210 | $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC); |
211 | 211 | if ($cellIdsResult === false) { |
212 | 212 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | // Get a new id for the new table name |
235 | 235 | $tableName = str_replace('.', '_', $this->getUniqueID()); |
236 | - if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
236 | + if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
237 | 237 | AS SELECT * FROM kvp_'.$this->TableName) |
238 | 238 | ) { |
239 | 239 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | if ($this->DBHandle === false) { |
279 | 279 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
280 | 280 | } |
281 | - if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
281 | + if (!$this->DBHandle->queryExec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
282 | 282 | throw new \PHPExcel\Exception(sqlite_error_string($this->DBHandle->lastError())); |
283 | 283 | } |
284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | public function __destruct() |
291 | 291 | { |
292 | 292 | if (!is_null($this->DBHandle)) { |
293 | - $this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName); |
|
293 | + $this->DBHandle->queryExec('DROP TABLE kvp_' . $this->TableName); |
|
294 | 294 | } |
295 | 295 | $this->DBHandle = null; |
296 | 296 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->storeData(); |
241 | 241 | } |
242 | 242 | |
243 | - $query = "SELECT id FROM kvp_".$this->TableName; |
|
243 | + $query = "SELECT id FROM kvp_" . $this->TableName; |
|
244 | 244 | $cellIdsResult = $this->DBHandle->query($query); |
245 | 245 | if ($cellIdsResult === false) { |
246 | 246 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | // Get a new id for the new table name |
269 | 269 | $tableName = str_replace('.', '_', $this->getUniqueID()); |
270 | - if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
270 | + if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $tableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB) |
|
271 | 271 | AS SELECT * FROM kvp_'.$this->TableName) |
272 | 272 | ) { |
273 | 273 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | if ($this->DBHandle === false) { |
313 | 313 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
314 | 314 | } |
315 | - if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
315 | + if (!$this->DBHandle->exec('CREATE TABLE kvp_' . $this->TableName . ' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) { |
|
316 | 316 | throw new \PHPExcel\Exception($this->DBHandle->lastErrorMsg()); |
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
320 | - $this->selectQuery = $this->DBHandle->prepare("SELECT value FROM kvp_".$this->TableName." WHERE id = :id"); |
|
321 | - $this->insertQuery = $this->DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES(:id,:data)"); |
|
322 | - $this->updateQuery = $this->DBHandle->prepare("UPDATE kvp_".$this->TableName." SET id=:toId WHERE id=:fromId"); |
|
323 | - $this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_".$this->TableName." WHERE id = :id"); |
|
320 | + $this->selectQuery = $this->DBHandle->prepare("SELECT value FROM kvp_" . $this->TableName . " WHERE id = :id"); |
|
321 | + $this->insertQuery = $this->DBHandle->prepare("INSERT OR REPLACE INTO kvp_" . $this->TableName . " VALUES(:id,:data)"); |
|
322 | + $this->updateQuery = $this->DBHandle->prepare("UPDATE kvp_" . $this->TableName . " SET id=:toId WHERE id=:fromId"); |
|
323 | + $this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_" . $this->TableName . " WHERE id = :id"); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | public function __destruct() |
330 | 330 | { |
331 | 331 | if (!is_null($this->DBHandle)) { |
332 | - $this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName); |
|
332 | + $this->DBHandle->exec('DROP TABLE kvp_' . $this->TableName); |
|
333 | 333 | $this->DBHandle->close(); |
334 | 334 | } |
335 | 335 | $this->DBHandle = null; |