@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getPageHeading() |
66 | 66 | { |
67 | - return $this->isIndex() ? '' : '<h1>' . str_replace('_', ' ', $this->getScriptFilename()) . '</h1>'; |
|
67 | + return $this->isIndex() ? '' : '<h1>'.str_replace('_', ' ', $this->getScriptFilename()).'</h1>'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | public function getSamples() |
76 | 76 | { |
77 | 77 | // Populate samples |
78 | - $baseDir = realpath(__DIR__ . '/../../../samples'); |
|
78 | + $baseDir = realpath(__DIR__.'/../../../samples'); |
|
79 | 79 | $directory = new RecursiveDirectoryIterator($baseDir); |
80 | 80 | $iterator = new RecursiveIteratorIterator($directory); |
81 | 81 | $regex = new RegexIterator($iterator, '/^.+\.php$/', RecursiveRegexIterator::GET_MATCH); |
82 | 82 | |
83 | 83 | $files = []; |
84 | 84 | foreach ($regex as $file) { |
85 | - $file = str_replace(str_replace('\\', '/', $baseDir) . '/', '', str_replace('\\', '/', $file[0])); |
|
85 | + $file = str_replace(str_replace('\\', '/', $baseDir).'/', '', str_replace('\\', '/', $file[0])); |
|
86 | 86 | $info = pathinfo($file); |
87 | 87 | $category = str_replace('_', ' ', $info['dirname']); |
88 | 88 | $name = str_replace('_', ' ', preg_replace('/(|\.php)/', '', $info['filename'])); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function getTemporaryFolder() |
141 | 141 | { |
142 | - $tempFolder = sys_get_temp_dir() . '/phpspreadsheet'; |
|
142 | + $tempFolder = sys_get_temp_dir().'/phpspreadsheet'; |
|
143 | 143 | if (!is_dir($tempFolder)) { |
144 | 144 | if (!mkdir($tempFolder) && !is_dir($tempFolder)) { |
145 | 145 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $tempFolder)); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $originalExtension = pathinfo($filename, PATHINFO_EXTENSION); |
163 | 163 | |
164 | - return $this->getTemporaryFolder() . '/' . str_replace('.' . $originalExtension, '.' . $extension, basename($filename)); |
|
164 | + return $this->getTemporaryFolder().'/'.str_replace('.'.$originalExtension, '.'.$extension, basename($filename)); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | $temporaryFilename = tempnam($this->getTemporaryFolder(), 'phpspreadsheet-'); |
177 | 177 | unlink($temporaryFilename); |
178 | 178 | |
179 | - return $temporaryFilename . '.' . $extension; |
|
179 | + return $temporaryFilename.'.'.$extension; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function log($message) |
183 | 183 | { |
184 | 184 | $eol = $this->isCli() ? PHP_EOL : '<br />'; |
185 | - echo date('H:i:s ') . $message . $eol; |
|
185 | + echo date('H:i:s ').$message.$eol; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function logEndingNotes() |
192 | 192 | { |
193 | 193 | // Do not show execution time for index |
194 | - $this->log('Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . 'MB'); |
|
194 | + $this->log('Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).'MB'); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $callTime = $callEndTime - $callStartTime; |
208 | 208 | $reflection = new ReflectionClass($writer); |
209 | 209 | $format = $reflection->getShortName(); |
210 | - $message = "Write {$format} format to <code>{$path}</code> in " . sprintf('%.4f', $callTime) . ' seconds'; |
|
210 | + $message = "Write {$format} format to <code>{$path}</code> in ".sprintf('%.4f', $callTime).' seconds'; |
|
211 | 211 | |
212 | 212 | $this->log($message); |
213 | 213 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $callEndTime = microtime(true); |
225 | 225 | $callTime = $callEndTime - $callStartTime; |
226 | - $message = "Read {$format} format from <code>{$path}</code> in " . sprintf('%.4f', $callTime) . ' seconds'; |
|
226 | + $message = "Read {$format} format from <code>{$path}</code> in ".sprintf('%.4f', $callTime).' seconds'; |
|
227 | 227 | |
228 | 228 | $this->log($message); |
229 | 229 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | // Load the HTML file into the DOM object |
620 | 620 | // Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup |
621 | 621 | $prefix = '<?xml encoding="UTF-8">'; |
622 | - @$dom->loadHTML($prefix . $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); |
|
622 | + @$dom->loadHTML($prefix.$html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); |
|
623 | 623 | // Discard excess white space |
624 | 624 | $dom->preserveWhiteSpace = false; |
625 | 625 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $richtextRun->getFont()->setSize($this->size); |
662 | 662 | } |
663 | 663 | if ($this->color) { |
664 | - $richtextRun->getFont()->setColor(new Color('ff' . $this->color)); |
|
664 | + $richtextRun->getFont()->setColor(new Color('ff'.$this->color)); |
|
665 | 665 | } |
666 | 666 | if ($this->bold) { |
667 | 667 | $richtextRun->getFont()->setBold(true); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $prefixedClasses = []; |
249 | 249 | foreach ($classes as $key => &$value) { |
250 | 250 | $value = str_replace('PhpOffice\\', '\\PhpOffice\\', $value); |
251 | - $prefixedClasses['\\' . $key] = $value; |
|
251 | + $prefixedClasses['\\'.$key] = $value; |
|
252 | 252 | } |
253 | 253 | $mapping = $prefixedClasses + $classes + $methods; |
254 | 254 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | ]; |
276 | 276 | |
277 | 277 | foreach ($patterns as $pattern) { |
278 | - foreach (glob($path . $pattern) as $file) { |
|
278 | + foreach (glob($path.$pattern) as $file) { |
|
279 | 279 | if (strpos($path, '/vendor/') !== false) { |
280 | - echo $file . " skipped\n"; |
|
280 | + echo $file." skipped\n"; |
|
281 | 281 | |
282 | 282 | continue; |
283 | 283 | } |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | $converted = $this->replace($original); |
286 | 286 | |
287 | 287 | if ($original !== $converted) { |
288 | - echo $file . " converted\n"; |
|
288 | + echo $file." converted\n"; |
|
289 | 289 | file_put_contents($file, $converted); |
290 | 290 | } |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | 294 | // Do the recursion in subdirectory |
295 | - foreach (glob($path . '/*', GLOB_ONLYDIR) as $subpath) { |
|
296 | - if (strpos($subpath, $path . '/') === 0) { |
|
295 | + foreach (glob($path.'/*', GLOB_ONLYDIR) as $subpath) { |
|
296 | + if (strpos($subpath, $path.'/') === 0) { |
|
297 | 297 | $this->recursiveReplace($subpath); |
298 | 298 | } |
299 | 299 | } |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | public function migrate() |
303 | 303 | { |
304 | 304 | $path = realpath(getcwd()); |
305 | - echo 'This will search and replace recursively in ' . $path . PHP_EOL; |
|
306 | - echo 'You MUST backup your files first, or you risk losing data.' . PHP_EOL; |
|
305 | + echo 'This will search and replace recursively in '.$path.PHP_EOL; |
|
306 | + echo 'You MUST backup your files first, or you risk losing data.'.PHP_EOL; |
|
307 | 307 | echo 'Are you sure ? (y/n)'; |
308 | 308 | |
309 | 309 | $confirm = fread(STDIN, 1); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | // The string "PHPExcel" gets special treatment because of how common it might be. |
327 | 327 | // This regex requires a word boundary around the string, and it can't be |
328 | 328 | // preceded by $ or -> (goal is to filter out cases where a variable is named $PHPExcel or similar) |
329 | - $converted = preg_replace('~(?<!\$|->)(\b|\\\\)PHPExcel\b~', '\\' . \PhpOffice\PhpSpreadsheet\Spreadsheet::class, $converted); |
|
329 | + $converted = preg_replace('~(?<!\$|->)(\b|\\\\)PHPExcel\b~', '\\'.\PhpOffice\PhpSpreadsheet\Spreadsheet::class, $converted); |
|
330 | 330 | |
331 | 331 | return $converted; |
332 | 332 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | return md5( |
158 | - $hashElements . |
|
158 | + $hashElements. |
|
159 | 159 | __CLASS__ |
160 | 160 | ); |
161 | 161 | } |
@@ -57,8 +57,8 @@ |
||
57 | 57 | public function getHashCode() |
58 | 58 | { |
59 | 59 | return md5( |
60 | - $this->getText() . |
|
61 | - $this->font->getHashCode() . |
|
60 | + $this->getText(). |
|
61 | + $this->font->getHashCode(). |
|
62 | 62 | __CLASS__ |
63 | 63 | ); |
64 | 64 | } |
@@ -64,7 +64,7 @@ |
||
64 | 64 | public function getHashCode() |
65 | 65 | { |
66 | 66 | return md5( |
67 | - $this->text . |
|
67 | + $this->text. |
|
68 | 68 | __CLASS__ |
69 | 69 | ); |
70 | 70 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function columnSort($a, $b) |
56 | 56 | { |
57 | - return strcasecmp(strlen($a) . $a, strlen($b) . $b); |
|
57 | + return strcasecmp(strlen($a).$a, strlen($b).$b); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function columnReverseSort($a, $b) |
70 | 70 | { |
71 | - return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b); |
|
71 | + return 1 - strcasecmp(strlen($a).$a, strlen($b).$b); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | [$bc, $br] = sscanf($b, '%[A-Z]%d'); |
87 | 87 | |
88 | 88 | if ($ar === $br) { |
89 | - return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); |
|
89 | + return strcasecmp(strlen($ac).$ac, strlen($bc).$bc); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return ($ar < $br) ? -1 : 1; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | [$bc, $br] = sscanf($b, '%[A-Z]%d'); |
108 | 108 | |
109 | 109 | if ($ar === $br) { |
110 | - return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc); |
|
110 | + return 1 - strcasecmp(strlen($ac).$ac, strlen($bc).$bc); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return ($ar < $br) ? 1 : -1; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $aColumnDimensions = array_reverse($pSheet->getColumnDimensions(), true); |
313 | 313 | if (!empty($aColumnDimensions)) { |
314 | 314 | foreach ($aColumnDimensions as $objColumnDimension) { |
315 | - $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex() . '1', $pBefore, $pNumCols, $pNumRows); |
|
315 | + $newReference = $this->updateCellReference($objColumnDimension->getColumnIndex().'1', $pBefore, $pNumCols, $pNumRows); |
|
316 | 316 | [$newReference] = Coordinate::coordinateFromString($newReference); |
317 | 317 | if ($objColumnDimension->getColumnIndex() != $newReference) { |
318 | 318 | $objColumnDimension->setColumnIndex($newReference); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $aRowDimensions = array_reverse($pSheet->getRowDimensions(), true); |
338 | 338 | if (!empty($aRowDimensions)) { |
339 | 339 | foreach ($aRowDimensions as $objRowDimension) { |
340 | - $newReference = $this->updateCellReference('A' . $objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
340 | + $newReference = $this->updateCellReference('A'.$objRowDimension->getRowIndex(), $pBefore, $pNumCols, $pNumRows); |
|
341 | 341 | [, $newReference] = Coordinate::coordinateFromString($newReference); |
342 | 342 | if ($objRowDimension->getRowIndex() != $newReference) { |
343 | 343 | $objRowDimension->setRowIndex($newReference); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) { |
384 | 384 | for ($i = 1; $i <= $highestRow - 1; ++$i) { |
385 | 385 | for ($j = $beforeColumnIndex - 1 + $pNumCols; $j <= $beforeColumnIndex - 2; ++$j) { |
386 | - $coordinate = Coordinate::stringFromColumnIndex($j + 1) . $i; |
|
386 | + $coordinate = Coordinate::stringFromColumnIndex($j + 1).$i; |
|
387 | 387 | $pSheet->removeConditionalStyles($coordinate); |
388 | 388 | if ($pSheet->cellExists($coordinate)) { |
389 | 389 | $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if ($pNumRows < 0 && $beforeRow - 1 + $pNumRows > 0) { |
398 | 398 | for ($i = $beforeColumnIndex - 1; $i <= Coordinate::columnIndexFromString($highestColumn) - 1; ++$i) { |
399 | 399 | for ($j = $beforeRow + $pNumRows; $j <= $beforeRow - 1; ++$j) { |
400 | - $coordinate = Coordinate::stringFromColumnIndex($i + 1) . $j; |
|
400 | + $coordinate = Coordinate::stringFromColumnIndex($i + 1).$j; |
|
401 | 401 | $pSheet->removeConditionalStyles($coordinate); |
402 | 402 | if ($pSheet->cellExists($coordinate)) { |
403 | 403 | $pSheet->getCell($coordinate)->setValueExplicit('', DataType::TYPE_NULL); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | // New coordinate |
424 | - $newCoordinate = Coordinate::stringFromColumnIndex($cellIndex + $pNumCols) . ($cell->getRow() + $pNumRows); |
|
424 | + $newCoordinate = Coordinate::stringFromColumnIndex($cellIndex + $pNumCols).($cell->getRow() + $pNumRows); |
|
425 | 425 | |
426 | 426 | // Should the cell be updated? Move value and cellXf index from one cell to another. |
427 | 427 | if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) { |
458 | 458 | for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) { |
459 | 459 | // Style |
460 | - $coordinate = Coordinate::stringFromColumnIndex($beforeColumnIndex - 1) . $i; |
|
460 | + $coordinate = Coordinate::stringFromColumnIndex($beforeColumnIndex - 1).$i; |
|
461 | 461 | if ($pSheet->cellExists($coordinate)) { |
462 | 462 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
463 | 463 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | foreach ($conditionalStyles as $conditionalStyle) { |
470 | 470 | $cloned[] = clone $conditionalStyle; |
471 | 471 | } |
472 | - $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($j) . $i, $cloned); |
|
472 | + $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($j).$i, $cloned); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | } |
@@ -479,19 +479,19 @@ discard block |
||
479 | 479 | if ($pNumRows > 0 && $beforeRow - 1 > 0) { |
480 | 480 | for ($i = $beforeColumnIndex; $i <= Coordinate::columnIndexFromString($highestColumn); ++$i) { |
481 | 481 | // Style |
482 | - $coordinate = Coordinate::stringFromColumnIndex($i) . ($beforeRow - 1); |
|
482 | + $coordinate = Coordinate::stringFromColumnIndex($i).($beforeRow - 1); |
|
483 | 483 | if ($pSheet->cellExists($coordinate)) { |
484 | 484 | $xfIndex = $pSheet->getCell($coordinate)->getXfIndex(); |
485 | 485 | $conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ? |
486 | 486 | $pSheet->getConditionalStyles($coordinate) : false; |
487 | 487 | for ($j = $beforeRow; $j <= $beforeRow - 1 + $pNumRows; ++$j) { |
488 | - $pSheet->getCell(Coordinate::stringFromColumnIndex($i) . $j)->setXfIndex($xfIndex); |
|
488 | + $pSheet->getCell(Coordinate::stringFromColumnIndex($i).$j)->setXfIndex($xfIndex); |
|
489 | 489 | if ($conditionalStyles) { |
490 | 490 | $cloned = []; |
491 | 491 | foreach ($conditionalStyles as $conditionalStyle) { |
492 | 492 | $cloned[] = clone $conditionalStyle; |
493 | 493 | } |
494 | - $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($i) . $j, $cloned); |
|
494 | + $pSheet->setConditionalStyles(Coordinate::stringFromColumnIndex($i).$j, $cloned); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | } |
@@ -639,102 +639,102 @@ discard block |
||
639 | 639 | $adjustCount = 0; |
640 | 640 | $newCellTokens = $cellTokens = []; |
641 | 641 | // Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5) |
642 | - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
642 | + $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
643 | 643 | if ($matchCount > 0) { |
644 | 644 | foreach ($matches as $match) { |
645 | - $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
646 | - $fromString .= $match[3] . ':' . $match[4]; |
|
647 | - $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
648 | - $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
645 | + $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
646 | + $fromString .= $match[3].':'.$match[4]; |
|
647 | + $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2); |
|
648 | + $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2); |
|
649 | 649 | |
650 | - if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
650 | + if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
651 | 651 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
652 | - $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
653 | - $toString .= $modified3 . ':' . $modified4; |
|
652 | + $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
653 | + $toString .= $modified3.':'.$modified4; |
|
654 | 654 | // 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 |
655 | 655 | $column = 100000; |
656 | 656 | $row = 10000000 + trim($match[3], '$'); |
657 | - $cellIndex = $column . $row; |
|
657 | + $cellIndex = $column.$row; |
|
658 | 658 | |
659 | 659 | $newCellTokens[$cellIndex] = preg_quote($toString, '/'); |
660 | - $cellTokens[$cellIndex] = '/(?<!\d\$\!)' . preg_quote($fromString, '/') . '(?!\d)/i'; |
|
660 | + $cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString, '/').'(?!\d)/i'; |
|
661 | 661 | ++$adjustCount; |
662 | 662 | } |
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
666 | 666 | // Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E) |
667 | - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
667 | + $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
668 | 668 | if ($matchCount > 0) { |
669 | 669 | foreach ($matches as $match) { |
670 | - $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
671 | - $fromString .= $match[3] . ':' . $match[4]; |
|
672 | - $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
673 | - $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
670 | + $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
671 | + $fromString .= $match[3].':'.$match[4]; |
|
672 | + $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
673 | + $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2); |
|
674 | 674 | |
675 | - if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) { |
|
675 | + if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) { |
|
676 | 676 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
677 | - $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
678 | - $toString .= $modified3 . ':' . $modified4; |
|
677 | + $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
678 | + $toString .= $modified3.':'.$modified4; |
|
679 | 679 | // 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 |
680 | 680 | $column = Coordinate::columnIndexFromString(trim($match[3], '$')) + 100000; |
681 | 681 | $row = 10000000; |
682 | - $cellIndex = $column . $row; |
|
682 | + $cellIndex = $column.$row; |
|
683 | 683 | |
684 | 684 | $newCellTokens[$cellIndex] = preg_quote($toString, '/'); |
685 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString, '/') . '(?![A-Z])/i'; |
|
685 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString, '/').'(?![A-Z])/i'; |
|
686 | 686 | ++$adjustCount; |
687 | 687 | } |
688 | 688 | } |
689 | 689 | } |
690 | 690 | } |
691 | 691 | // Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5) |
692 | - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
692 | + $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
693 | 693 | if ($matchCount > 0) { |
694 | 694 | foreach ($matches as $match) { |
695 | - $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
696 | - $fromString .= $match[3] . ':' . $match[4]; |
|
695 | + $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
696 | + $fromString .= $match[3].':'.$match[4]; |
|
697 | 697 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
698 | 698 | $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows); |
699 | 699 | |
700 | - if ($match[3] . $match[4] !== $modified3 . $modified4) { |
|
700 | + if ($match[3].$match[4] !== $modified3.$modified4) { |
|
701 | 701 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
702 | - $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
703 | - $toString .= $modified3 . ':' . $modified4; |
|
702 | + $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
703 | + $toString .= $modified3.':'.$modified4; |
|
704 | 704 | [$column, $row] = Coordinate::coordinateFromString($match[3]); |
705 | 705 | // 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 |
706 | 706 | $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000; |
707 | 707 | $row = trim($row, '$') + 10000000; |
708 | - $cellIndex = $column . $row; |
|
708 | + $cellIndex = $column.$row; |
|
709 | 709 | |
710 | 710 | $newCellTokens[$cellIndex] = preg_quote($toString, '/'); |
711 | - $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString, '/') . '(?!\d)/i'; |
|
711 | + $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString, '/').'(?!\d)/i'; |
|
712 | 712 | ++$adjustCount; |
713 | 713 | } |
714 | 714 | } |
715 | 715 | } |
716 | 716 | } |
717 | 717 | // Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5) |
718 | - $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER); |
|
718 | + $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER); |
|
719 | 719 | |
720 | 720 | if ($matchCount > 0) { |
721 | 721 | foreach ($matches as $match) { |
722 | - $fromString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
722 | + $fromString = ($match[2] > '') ? $match[2].'!' : ''; |
|
723 | 723 | $fromString .= $match[3]; |
724 | 724 | |
725 | 725 | $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows); |
726 | 726 | if ($match[3] !== $modified3) { |
727 | 727 | if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) { |
728 | - $toString = ($match[2] > '') ? $match[2] . '!' : ''; |
|
728 | + $toString = ($match[2] > '') ? $match[2].'!' : ''; |
|
729 | 729 | $toString .= $modified3; |
730 | 730 | [$column, $row] = Coordinate::coordinateFromString($match[3]); |
731 | 731 | // 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 |
732 | 732 | $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000; |
733 | 733 | $row = trim($row, '$') + 10000000; |
734 | - $cellIndex = $row . $column; |
|
734 | + $cellIndex = $row.$column; |
|
735 | 735 | |
736 | 736 | $newCellTokens[$cellIndex] = preg_quote($toString, '/'); |
737 | - $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString, '/') . '(?!\d)/i'; |
|
737 | + $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString, '/').'(?!\d)/i'; |
|
738 | 738 | ++$adjustCount; |
739 | 739 | } |
740 | 740 | } |
@@ -807,8 +807,8 @@ discard block |
||
807 | 807 | if (($cell !== null) && ($cell->getDataType() == DataType::TYPE_FORMULA)) { |
808 | 808 | $formula = $cell->getValue(); |
809 | 809 | if (strpos($formula, $oldName) !== false) { |
810 | - $formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula); |
|
811 | - $formula = str_replace($oldName . '!', $newName . '!', $formula); |
|
810 | + $formula = str_replace("'".$oldName."'!", "'".$newName."'!", $formula); |
|
811 | + $formula = str_replace($oldName.'!', $newName.'!', $formula); |
|
812 | 812 | $cell->setValueExplicit($formula, DataType::TYPE_FORMULA); |
813 | 813 | } |
814 | 814 | } |
@@ -841,10 +841,10 @@ discard block |
||
841 | 841 | $jc = count($range[$i]); |
842 | 842 | for ($j = 0; $j < $jc; ++$j) { |
843 | 843 | if (ctype_alpha($range[$i][$j])) { |
844 | - $r = Coordinate::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $pBefore, $pNumCols, $pNumRows)); |
|
844 | + $r = Coordinate::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows)); |
|
845 | 845 | $range[$i][$j] = $r[0]; |
846 | 846 | } elseif (ctype_digit($range[$i][$j])) { |
847 | - $r = Coordinate::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
847 | + $r = Coordinate::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows)); |
|
848 | 848 | $range[$i][$j] = $r[1]; |
849 | 849 | } else { |
850 | 850 | $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows); |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | } |
896 | 896 | |
897 | 897 | // Return new reference |
898 | - return $newColumn . $newRow; |
|
898 | + return $newColumn.$newRow; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | /** |
@@ -231,8 +231,8 @@ |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | return md5( |
234 | - $this->borderStyle . |
|
235 | - $this->color->getHashCode() . |
|
234 | + $this->borderStyle. |
|
235 | + $this->color->getHashCode(). |
|
236 | 236 | __CLASS__ |
237 | 237 | ); |
238 | 238 | } |
@@ -453,13 +453,13 @@ |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | return md5( |
456 | - $this->horizontal . |
|
457 | - $this->vertical . |
|
458 | - $this->textRotation . |
|
459 | - ($this->wrapText ? 't' : 'f') . |
|
460 | - ($this->shrinkToFit ? 't' : 'f') . |
|
461 | - $this->indent . |
|
462 | - $this->readOrder . |
|
456 | + $this->horizontal. |
|
457 | + $this->vertical. |
|
458 | + $this->textRotation. |
|
459 | + ($this->wrapText ? 't' : 'f'). |
|
460 | + ($this->shrinkToFit ? 't' : 'f'). |
|
461 | + $this->indent. |
|
462 | + $this->readOrder. |
|
463 | 463 | __CLASS__ |
464 | 464 | ); |
465 | 465 | } |