@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | |
110 | 110 | $adjustmentMonthsString = (string) $adjustmentMonths; |
111 | 111 | if ($adjustmentMonths > 0) { |
112 | - $adjustmentMonthsString = '+' . $adjustmentMonths; |
|
112 | + $adjustmentMonthsString = '+'.$adjustmentMonths; |
|
113 | 113 | } |
114 | 114 | if ($adjustmentMonths != 0) { |
115 | - $PHPDateObject->modify($adjustmentMonthsString . ' months'); |
|
115 | + $PHPDateObject->modify($adjustmentMonthsString.' months'); |
|
116 | 116 | } |
117 | 117 | $nMonth = (int) $PHPDateObject->format('m'); |
118 | 118 | $nYear = (int) $PHPDateObject->format('Y'); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12); |
121 | 121 | if ($monthDiff != $adjustmentMonths) { |
122 | 122 | $adjustDays = (int) $PHPDateObject->format('d'); |
123 | - $adjustDaysString = '-' . $adjustDays . ' days'; |
|
123 | + $adjustDaysString = '-'.$adjustDays.' days'; |
|
124 | 124 | $PHPDateObject->modify($adjustDaysString); |
125 | 125 | } |
126 | 126 | |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | $dayAdjust = floor($hour / 24); |
435 | 435 | $hour = $hour % 24; |
436 | 436 | } |
437 | - $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second); |
|
437 | + $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second); |
|
438 | 438 | if ($dayAdjust != 0) { |
439 | - $phpDateObject->modify($dayAdjust . ' days'); |
|
439 | + $phpDateObject->modify($dayAdjust.' days'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | return $phpDateObject; |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) { |
530 | 530 | $testVal3 += 2000; |
531 | 531 | } |
532 | - $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3); |
|
532 | + $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3); |
|
533 | 533 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
534 | - $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3); |
|
534 | + $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3); |
|
535 | 535 | if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) { |
536 | 536 | return Functions::VALUE(); |
537 | 537 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | case Functions::RETURNDATE_UNIX_TIMESTAMP: |
572 | 572 | return (int) Date::excelToTimestamp($excelDateValue); |
573 | 573 | case Functions::RETURNDATE_PHP_DATETIME_OBJECT: |
574 | - return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00'); |
|
574 | + return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00'); |
|
575 | 575 | } |
576 | 576 | } |
577 | 577 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | case Functions::RETURNDATE_UNIX_TIMESTAMP: |
634 | 634 | return (int) $phpDateValue = Date::excelToTimestamp($excelDateValue + 25569) - 3600; |
635 | 635 | case Functions::RETURNDATE_PHP_DATETIME_OBJECT: |
636 | - return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']); |
|
636 | + return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']); |
|
637 | 637 | } |
638 | 638 | } |
639 | 639 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | case 'MD': |
712 | 712 | if ($endDays < $startDays) { |
713 | 713 | $retVal = $endDays; |
714 | - $PHPEndDateObject->modify('-' . $endDays . ' days'); |
|
714 | + $PHPEndDateObject->modify('-'.$endDays.' days'); |
|
715 | 715 | $adjustDays = $PHPEndDateObject->format('j'); |
716 | 716 | $retVal += ($adjustDays - $startDays); |
717 | 717 | } else { |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | return (int) $PHPDateObject->format('W'); |
1365 | 1365 | } |
1366 | 1366 | $dayOfYear = $PHPDateObject->format('z'); |
1367 | - $PHPDateObject->modify('-' . $dayOfYear . ' days'); |
|
1367 | + $PHPDateObject->modify('-'.$dayOfYear.' days'); |
|
1368 | 1368 | $firstDayOfFirstWeek = $PHPDateObject->format('w'); |
1369 | 1369 | $daysInFirstWeek = (6 - $firstDayOfFirstWeek + $method) % 7; |
1370 | 1370 | $daysInFirstWeek += 7 * !$daysInFirstWeek; |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | // Execute function |
1677 | 1677 | $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1); |
1678 | 1678 | $adjustDays = (int) $PHPDateObject->format('d'); |
1679 | - $adjustDaysString = '-' . $adjustDays . ' days'; |
|
1679 | + $adjustDaysString = '-'.$adjustDays.' days'; |
|
1680 | 1680 | $PHPDateObject->modify($adjustDaysString); |
1681 | 1681 | |
1682 | 1682 | switch (Functions::getReturnDateType()) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $condition = Calculation::wrapResult(strtoupper($condition)); |
281 | 281 | } |
282 | 282 | |
283 | - return str_replace('""""', '""', '=' . $condition); |
|
283 | + return str_replace('""""', '""', '='.$condition); |
|
284 | 284 | } |
285 | 285 | preg_match('/(=|<[>=]?|>=?)(.*)/', $condition, $matches); |
286 | 286 | [, $operator, $operand] = $matches; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $operand = Calculation::wrapResult(strtoupper($operand)); |
293 | 293 | } |
294 | 294 | |
295 | - return str_replace('""""', '""', $operator . $operand); |
|
295 | + return str_replace('""""', '""', $operator.$operand); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -622,10 +622,10 @@ discard block |
||
622 | 622 | foreach ($value as $k2 => $val) { |
623 | 623 | if (is_array($val)) { |
624 | 624 | foreach ($val as $k3 => $v) { |
625 | - $arrayValues[$k1 . '.' . $k2 . '.' . $k3] = $v; |
|
625 | + $arrayValues[$k1.'.'.$k2.'.'.$k3] = $v; |
|
626 | 626 | } |
627 | 627 | } else { |
628 | - $arrayValues[$k1 . '.' . $k2] = $val; |
|
628 | + $arrayValues[$k1.'.'.$k2] = $val; |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | } else { |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | return self::REF(); |
667 | 667 | } |
668 | 668 | |
669 | - preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellReference, $matches); |
|
669 | + preg_match('/^'.Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellReference, $matches); |
|
670 | 670 | |
671 | - $cellReference = $matches[6] . $matches[7]; |
|
671 | + $cellReference = $matches[6].$matches[7]; |
|
672 | 672 | $worksheetName = trim($matches[3], "'"); |
673 | 673 | |
674 | 674 | $worksheet = (!empty($worksheetName)) |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public static function setChartRenderer($rendererClass) |
68 | 68 | { |
69 | 69 | if (!is_a($rendererClass, IRenderer::class, true)) { |
70 | - throw new Exception('Chart renderer must implement ' . IRenderer::class); |
|
70 | + throw new Exception('Chart renderer must implement '.IRenderer::class); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | self::$chartRenderer = $rendererClass; |
@@ -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 | } |