Completed
Push — develop ( e1f81f...539a89 )
by Adrien
16:11
created
src/PhpSpreadsheet/CachedObjectStorage/APC.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
                 return true;
107 107
             }
108 108
             //    Check if the requested entry still exists in apc
109
-            $success = apc_fetch($this->cachePrefix.$pCoord.'.cache');
109
+            $success = apc_fetch($this->cachePrefix . $pCoord . '.cache');
110 110
             if ($success === false) {
111 111
                 //    Entry no longer exists in APC, so clear it from the cache array
112 112
                 parent::deleteCacheData($pCoord);
113
-                throw new \PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
113
+                throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
114 114
             }
115 115
             return true;
116 116
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             if ($obj === false) {
139 139
                 //    Entry no longer exists in APC, so clear it from the cache array
140 140
                 parent::deleteCacheData($pCoord);
141
-                throw new \PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
141
+                throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
142 142
             }
143 143
         } else {
144 144
             //    Return null if requested entry doesn't exist in cache
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     public function deleteCacheData($pCoord)
180 180
     {
181 181
         //    Delete the entry from APC
182
-        apc_delete($this->cachePrefix.$pCoord.'.cache');
182
+        apc_delete($this->cachePrefix . $pCoord . '.cache');
183 183
 
184 184
         //    Delete the entry from our cell address array
185 185
         parent::deleteCacheData($pCoord);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/CachedObjectStorage/Wincache.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
             $this->currentObject->detach();
55 55
 
56 56
             $obj = serialize($this->currentObject);
57
-            if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
58
-                if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
57
+            if (wincache_ucache_exists($this->cachePrefix . $this->currentObjectID . '.cache')) {
58
+                if (!wincache_ucache_set($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
59 59
                     $this->__destruct();
60
-                    throw new \PhpSpreadsheet\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
60
+                    throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
61 61
                 }
62 62
             } else {
63
-                if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
63
+                if (!wincache_ucache_add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, $this->cacheTime)) {
64 64
                     $this->__destruct();
65
-                    throw new \PhpSpreadsheet\Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
65
+                    throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $this->currentObjectID . ' in WinCache');
66 66
                 }
67 67
             }
68 68
             $this->currentCellIsDirty = false;
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
                 return true;
109 109
             }
110 110
             //    Check if the requested entry still exists in cache
111
-            $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache');
111
+            $success = wincache_ucache_exists($this->cachePrefix . $pCoord . '.cache');
112 112
             if ($success === false) {
113 113
                 //    Entry no longer exists in Wincache, so clear it from the cache array
114 114
                 parent::deleteCacheData($pCoord);
115
-                throw new \PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
115
+                throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
116 116
             }
117 117
             return true;
118 118
         }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
         $obj = null;
139 139
         if (parent::isDataSet($pCoord)) {
140 140
             $success = false;
141
-            $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success);
141
+            $obj = wincache_ucache_get($this->cachePrefix . $pCoord . '.cache', $success);
142 142
             if ($success === false) {
143 143
                 //    Entry no longer exists in WinCache, so clear it from the cache array
144 144
                 parent::deleteCacheData($pCoord);
145
-                throw new \PhpSpreadsheet\Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
145
+                throw new \PhpSpreadsheet\Exception('Cell entry ' . $pCoord . ' no longer exists in WinCache');
146 146
             }
147 147
         } else {
148 148
             //    Return null if requested entry doesn't exist in cache
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     public function deleteCacheData($pCoord)
184 184
     {
185 185
         //    Delete the entry from Wincache
186
-        wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache');
186
+        wincache_ucache_delete($this->cachePrefix . $pCoord . '.cache');
187 187
 
188 188
         //    Delete the entry from our cell address array
189 189
         parent::deleteCacheData($pCoord);
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
         foreach ($cacheList as $cellID) {
206 206
             if ($cellID != $this->currentObjectID) {
207 207
                 $success = false;
208
-                $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success);
208
+                $obj = wincache_ucache_get($this->cachePrefix . $cellID . '.cache', $success);
209 209
                 if ($success === false) {
210 210
                     //    Entry no longer exists in WinCache, so clear it from the cache array
211 211
                     parent::deleteCacheData($cellID);
212
-                    throw new \PhpSpreadsheet\Exception('Cell entry '.$cellID.' no longer exists in Wincache');
212
+                    throw new \PhpSpreadsheet\Exception('Cell entry ' . $cellID . ' no longer exists in Wincache');
213 213
                 }
214
-                if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) {
214
+                if (!wincache_ucache_add($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
215 215
                     $this->__destruct();
216
-                    throw new \PhpSpreadsheet\Exception('Failed to store cell '.$cellID.' in Wincache');
216
+                    throw new \PhpSpreadsheet\Exception('Failed to store cell ' . $cellID . ' in Wincache');
217 217
                 }
218 218
             }
219 219
         }
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
252 252
     {
253
-        $cacheTime    = (isset($arguments['cacheTime']))    ? $arguments['cacheTime']    : 600;
253
+        $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
254 254
 
255 255
         if (is_null($this->cachePrefix)) {
256 256
             $baseUnique = $this->getUniqueID();
257
-            $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.';
257
+            $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
258 258
             $this->cacheTime = $cacheTime;
259 259
 
260 260
             parent::__construct($parent);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $cacheList = $this->getCellList();
270 270
         foreach ($cacheList as $cellID) {
271
-            wincache_ucache_delete($this->cachePrefix.$cellID.'.cache');
271
+            wincache_ucache_delete($this->cachePrefix . $cellID . '.cache');
272 272
         }
273 273
     }
274 274
 
Please login to merge, or discard this patch.
src/PhpSpreadsheet/CachedObjectStorage/DiscISAM.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         parent::copyCellCollection($parent);
147 147
         //    Get a new id for the new file name
148 148
         $baseUnique = $this->getUniqueID();
149
-        $newFileName = $this->cacheDirectory.'/PhpSpreadsheet.'.$baseUnique.'.cache';
149
+        $newFileName = $this->cacheDirectory . '/PhpSpreadsheet.' . $baseUnique . '.cache';
150 150
         //    Copy the existing cell cache file
151 151
         copy($this->fileName, $newFileName);
152 152
         $this->fileName = $newFileName;
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function __construct(\PhpSpreadsheet\Worksheet $parent, $arguments)
183 183
     {
184
-        $this->cacheDirectory    = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
184
+        $this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
185 185
                                     ? $arguments['dir']
186 186
                                     : \PhpSpreadsheet\Shared\File::sysGetTempDir();
187 187
 
188 188
         parent::__construct($parent);
189 189
         if (is_null($this->fileHandle)) {
190 190
             $baseUnique = $this->getUniqueID();
191
-            $this->fileName = $this->cacheDirectory.'/PhpSpreadsheet.'.$baseUnique.'.cache';
191
+            $this->fileName = $this->cacheDirectory . '/PhpSpreadsheet.' . $baseUnique . '.cache';
192 192
             $this->fileHandle = fopen($this->fileName, 'a+');
193 193
         }
194 194
     }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Chart/Renderer/JpGraph.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace PhpSpreadsheet\Chart\Renderer;
4 4
 
5
-require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'/jpgraph.php');
5
+require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . '/jpgraph.php');
6 6
 
7 7
 /**
8 8
  * Copyright (c) 2006 - 2016 PhpSpreadsheet
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class JpGraph
30 30
 {
31
-    private static $width    = 640;
31
+    private static $width = 640;
32 32
 
33 33
     private static $height    = 480;
34 34
 
35 35
     private static $colourSet = [
36
-        'mediumpurple1',    'palegreen3',     'gold1',          'cadetblue1',
37
-        'darkmagenta',      'coral',          'dodgerblue3',    'eggplant',
38
-        'mediumblue',       'magenta',        'sandybrown',     'cyan',
39
-        'firebrick1',       'forestgreen',    'deeppink4',      'darkolivegreen',
36
+        'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
37
+        'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
38
+        'mediumblue', 'magenta', 'sandybrown', 'cyan',
39
+        'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
40 40
         'goldenrod2'
41 41
     ];
42 42
 
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
             $legendOverlay = $legend->getOverlay();
186 186
             switch ($legendPosition) {
187 187
                 case 'r':
188
-                    $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center');    //    right
188
+                    $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); //    right
189 189
                     $this->graph->legend->SetColumns(1);
190 190
                     break;
191 191
                 case 'l':
192
-                    $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center');    //    left
192
+                    $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center'); //    left
193 193
                     $this->graph->legend->SetColumns(1);
194 194
                     break;
195 195
                 case 't':
196
-                    $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top');    //    top
196
+                    $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top'); //    top
197 197
                     break;
198 198
                 case 'b':
199
-                    $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom');    //    bottom
199
+                    $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); //    bottom
200 200
                     break;
201 201
                 default:
202
-                    $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top');    //    top-right
202
+                    $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top'); //    top-right
203 203
                     $this->graph->legend->SetColumns(1);
204 204
                     break;
205 205
             }
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 
563 563
     private function renderAreaChart($groupCount, $dimensions = '2d')
564 564
     {
565
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php');
565
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_line.php');
566 566
 
567 567
         $this->renderCartesianPlotArea();
568 568
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
     private function renderLineChart($groupCount, $dimensions = '2d')
576 576
     {
577
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php');
577
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_line.php');
578 578
 
579 579
         $this->renderCartesianPlotArea();
580 580
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
     private function renderBarChart($groupCount, $dimensions = '2d')
588 588
     {
589
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_bar.php');
589
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_bar.php');
590 590
 
591 591
         $this->renderCartesianPlotArea();
592 592
 
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 
599 599
     private function renderScatterChart($groupCount)
600 600
     {
601
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_scatter.php');
602
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_regstat.php');
603
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php');
601
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_scatter.php');
602
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_regstat.php');
603
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_line.php');
604 604
 
605 605
         $this->renderCartesianPlotArea('linlin');
606 606
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
     private function renderBubbleChart($groupCount)
614 614
     {
615
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_scatter.php');
615
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_scatter.php');
616 616
 
617 617
         $this->renderCartesianPlotArea('linlin');
618 618
 
@@ -624,9 +624,9 @@  discard block
 block discarded – undo
624 624
 
625 625
     private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
626 626
     {
627
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_pie.php');
627
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_pie.php');
628 628
         if ($dimensions == '3d') {
629
-            require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_pie3d.php');
629
+            require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_pie3d.php');
630 630
         }
631 631
 
632 632
         $this->renderPiePlotArea($doughnut);
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
                 }
673 673
 
674 674
                 if ($multiplePlots) {
675
-                    $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
675
+                    $seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4));
676 676
                 }
677 677
 
678 678
                 if ($doughnut) {
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
     private function renderRadarChart($groupCount)
703 703
     {
704
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_radar.php');
704
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_radar.php');
705 705
 
706 706
         $this->renderRadarPlotArea();
707 707
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 
714 714
     private function renderStockChart($groupCount)
715 715
     {
716
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_stock.php');
716
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_stock.php');
717 717
 
718 718
         $this->renderCartesianPlotArea('intint');
719 719
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 
726 726
     private function renderContourChart($groupCount, $dimensions)
727 727
     {
728
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_contour.php');
728
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_contour.php');
729 729
 
730 730
         $this->renderCartesianPlotArea('intint');
731 731
 
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
 
738 738
     private function renderCombinationChart($groupCount, $dimensions, $outputDestination)
739 739
     {
740
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php');
741
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_bar.php');
742
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_scatter.php');
743
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_regstat.php');
744
-        require_once(\PhpSpreadsheet\Settings::getChartRendererPath().'jpgraph_line.php');
740
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_line.php');
741
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_bar.php');
742
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_scatter.php');
743
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_regstat.php');
744
+        require_once(\PhpSpreadsheet\Settings::getChartRendererPath() . 'jpgraph_line.php');
745 745
 
746 746
         $this->renderCartesianPlotArea();
747 747
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                 $this->renderStockChart($groupCount, $dimensions);
862 862
                 break;
863 863
             default:
864
-                echo $chartType.' is not yet implemented<br />';
864
+                echo $chartType . ' is not yet implemented<br />';
865 865
                 return false;
866 866
         }
867 867
         $this->renderLegend();
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Calculation/Database.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         if (is_numeric($field)) {
53 53
             $keys = array_keys($fieldNames);
54
-            return $keys[$field-1];
54
+            return $keys[$field - 1];
55 55
         }
56 56
         $key = array_search($field, $fieldNames);
57 57
         return ($key) ? $key : null;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $testConditionCount = 0;
90 90
             foreach ($criteria as $row => $criterion) {
91 91
                 if ($criterion[$key] > '') {
92
-                    $testCondition[] = '[:'.$criteriaName.']'.Functions::ifCondition($criterion[$key]);
92
+                    $testCondition[] = '[:' . $criteriaName . ']' . Functions::ifCondition($criterion[$key]);
93 93
                     $testConditionCount++;
94 94
                 }
95 95
             }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 }
122 122
             }
123 123
             //    evaluate the criteria against the row data
124
-            $result = \PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
124
+            $result = \PhpSpreadsheet\Calculation::getInstance()->_calculateFormulaValue('=' . $testConditionList);
125 125
             //    If the row failed to meet the criteria, remove it from the database
126 126
             if (!$result) {
127 127
                 unset($database[$dataRow]);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Calculation/LookupRef.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -60,28 +60,28 @@  discard block
 block discarded – undo
60 60
 
61 61
         if ($sheetText > '') {
62 62
             if (strpos($sheetText, ' ') !== false) {
63
-                $sheetText = "'".$sheetText."'";
63
+                $sheetText = "'" . $sheetText . "'";
64 64
             }
65
-            $sheetText .='!';
65
+            $sheetText .= '!';
66 66
         }
67 67
         if ((!is_bool($referenceStyle)) || $referenceStyle) {
68 68
             $rowRelative = $columnRelative = '$';
69
-            $column = \PhpSpreadsheet\Cell::stringFromColumnIndex($column-1);
69
+            $column = \PhpSpreadsheet\Cell::stringFromColumnIndex($column - 1);
70 70
             if (($relativity == 2) || ($relativity == 4)) {
71 71
                 $columnRelative = '';
72 72
             }
73 73
             if (($relativity == 3) || ($relativity == 4)) {
74 74
                 $rowRelative = '';
75 75
             }
76
-            return $sheetText.$columnRelative.$column.$rowRelative.$row;
76
+            return $sheetText . $columnRelative . $column . $rowRelative . $row;
77 77
         } else {
78 78
             if (($relativity == 2) || ($relativity == 4)) {
79
-                $column = '['.$column.']';
79
+                $column = '[' . $column . ']';
80 80
             }
81 81
             if (($relativity == 3) || ($relativity == 4)) {
82
-                $row = '['.$row.']';
82
+                $row = '[' . $row . ']';
83 83
             }
84
-            return $sheetText.'R'.$row.'C'.$column;
84
+            return $sheetText . 'R' . $row . 'C' . $column;
85 85
         }
86 86
     }
87 87
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $args = func_get_args();
260 260
         $pCell = array_pop($args);
261 261
 
262
-        $linkURL     = (is_null($linkURL))     ? '' : Functions::flattenSingleValue($linkURL);
262
+        $linkURL     = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL);
263 263
         $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName);
264 264
 
265 265
         if ((!is_object($pCell)) || (trim($linkURL) == '')) {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      */
298 298
     public static function INDIRECT($cellAddress = null, \PhpSpreadsheet\Cell $pCell = null)
299 299
     {
300
-        $cellAddress    = Functions::flattenSingleValue($cellAddress);
300
+        $cellAddress = Functions::flattenSingleValue($cellAddress);
301 301
         if (is_null($cellAddress) || $cellAddress === '') {
302 302
             return Functions::REF();
303 303
         }
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
             list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
309 309
         }
310 310
 
311
-        if ((!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
312
-            ((!is_null($cellAddress2)) && (!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
313
-            if (!preg_match('/^'.\PhpSpreadsheet\Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
311
+        if ((!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) ||
312
+            ((!is_null($cellAddress2)) && (!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches)))) {
313
+            if (!preg_match('/^' . \PhpSpreadsheet\Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $cellAddress1, $matches)) {
314 314
                 return Functions::REF();
315 315
             }
316 316
 
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
         }
418 418
         $endCellColumn = \PhpSpreadsheet\Cell::stringFromColumnIndex($endCellColumn);
419 419
 
420
-        $cellAddress = $startCellColumn.$startCellRow;
420
+        $cellAddress = $startCellColumn . $startCellRow;
421 421
         if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
422
-            $cellAddress .= ':'.$endCellColumn.$endCellRow;
422
+            $cellAddress .= ':' . $endCellColumn . $endCellRow;
423 423
         }
424 424
 
425 425
         if ($sheetName !== null) {
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
     {
495 495
         $lookup_array = Functions::flattenArray($lookup_array);
496 496
         $lookup_value = Functions::flattenSingleValue($lookup_value);
497
-        $match_type    = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type);
497
+        $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type);
498 498
         //    MATCH is not case sensitive
499 499
         $lookup_value = strtolower($lookup_value);
500 500
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 $lookup_array[$i] = strtolower($lookupArrayValue);
527 527
             }
528 528
             if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
529
-                $lookup_array = array_slice($lookup_array, 0, $i-1);
529
+                $lookup_array = array_slice($lookup_array, 0, $i - 1);
530 530
             }
531 531
         }
532 532
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                     break;
555 555
                 } else {
556 556
                     // the previous cell was the match
557
-                    return $keySet[$i-1]+1;
557
+                    return $keySet[$i - 1] + 1;
558 558
                 }
559 559
             } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
560 560
                 $i = array_search($i, $keySet);
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                     break;
565 565
                 } else {
566 566
                     // the previous cell was the match
567
-                    return $keySet[$i-1]+1;
567
+                    return $keySet[$i - 1] + 1;
568 568
                 }
569 569
             }
570 570
         }
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
     {
753 753
         $lookup_value   = Functions::flattenSingleValue($lookup_value);
754 754
         $index_number   = Functions::flattenSingleValue($index_number);
755
-        $not_exact_match    = Functions::flattenSingleValue($not_exact_match);
755
+        $not_exact_match = Functions::flattenSingleValue($not_exact_match);
756 756
 
757 757
         // index_number must be greater than or equal to 1
758 758
         if ($index_number < 1) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Calculation/DateTime.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 
127 127
         $adjustmentMonthsString = (string) $adjustmentMonths;
128 128
         if ($adjustmentMonths > 0) {
129
-            $adjustmentMonthsString = '+'.$adjustmentMonths;
129
+            $adjustmentMonthsString = '+' . $adjustmentMonths;
130 130
         }
131 131
         if ($adjustmentMonths != 0) {
132
-            $PHPDateObject->modify($adjustmentMonthsString.' months');
132
+            $PHPDateObject->modify($adjustmentMonthsString . ' months');
133 133
         }
134 134
         $nMonth = (int) $PHPDateObject->format('m');
135 135
         $nYear = (int) $PHPDateObject->format('Y');
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $monthDiff = ($nMonth - $oMonth) + (($nYear - $oYear) * 12);
138 138
         if ($monthDiff != $adjustmentMonths) {
139 139
             $adjustDays = (int) $PHPDateObject->format('d');
140
-            $adjustDaysString = '-'.$adjustDays.' days';
140
+            $adjustDaysString = '-' . $adjustDays . ' days';
141 141
             $PHPDateObject->modify($adjustDaysString);
142 142
         }
143 143
         return $PHPDateObject;
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
             (!is_numeric($day))) {
300 300
             return Functions::VALUE();
301 301
         }
302
-        $year    = (integer) $year;
302
+        $year = (integer) $year;
303 303
         $month    = (integer) $month;
304
-        $day    = (integer) $day;
304
+        $day = (integer) $day;
305 305
 
306 306
         $baseYear = \PhpSpreadsheet\Shared\Date::getExcelCalendar();
307 307
         // Validate parameters
308
-        if ($year < ($baseYear-1900)) {
308
+        if ($year < ($baseYear - 1900)) {
309 309
             return Functions::NAN();
310 310
         }
311
-        if ((($baseYear-1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
311
+        if ((($baseYear - 1900) != 0) && ($year < $baseYear) && ($year >= 1900)) {
312 312
             return Functions::NAN();
313 313
         }
314 314
 
315
-        if (($year < $baseYear) && ($year >= ($baseYear-1900))) {
315
+        if (($year < $baseYear) && ($year >= ($baseYear - 1900))) {
316 316
             $year += 1900;
317 317
         }
318 318
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                 }
433 433
                 return (float) \PhpSpreadsheet\Shared\Date::formattedPHPToExcel($calendar, 1, $date, $hour, $minute, $second);
434 434
             case Functions::RETURNDATE_PHP_NUMERIC:
435
-                return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second));    // -2147468400; //    -2147472000 + 3600
435
+                return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp(\PhpSpreadsheet\Shared\Date::formattedPHPToExcel(1970, 1, 1, $hour, $minute, $second)); // -2147468400; //    -2147472000 + 3600
436 436
             case Functions::RETURNDATE_PHP_OBJECT:
437 437
                 $dayAdjust = 0;
438 438
                 if ($hour < 0) {
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
                     $dayAdjust = floor($hour / 24);
446 446
                     $hour = $hour % 24;
447 447
                 }
448
-                $phpDateObject = new \DateTime('1900-01-01 '.$hour.':'.$minute.':'.$second);
448
+                $phpDateObject = new \DateTime('1900-01-01 ' . $hour . ':' . $minute . ':' . $second);
449 449
                 if ($dayAdjust != 0) {
450
-                    $phpDateObject->modify($dayAdjust.' days');
450
+                    $phpDateObject->modify($dayAdjust . ' days');
451 451
                 }
452 452
                 return $phpDateObject;
453 453
         }
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
      */
483 483
     public static function DATEVALUE($dateValue = 1)
484 484
     {
485
-        $dateValueOrig= $dateValue;
485
+        $dateValueOrig = $dateValue;
486 486
         $dateValue = trim(Functions::flattenSingleValue($dateValue), '"');
487 487
         //    Strip any ordinals because they're allowed in Excel (English only)
488 488
         $dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
489 489
         //    Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
490
-        $dateValue    = str_replace(array('/', '.', '-', '  '), array(' ', ' ', ' ', ' '), $dateValue);
490
+        $dateValue = str_replace(array('/', '.', '-', '  '), array(' ', ' ', ' ', ' '), $dateValue);
491 491
 
492 492
         $yearFound = false;
493 493
         $t1 = explode(' ', $dateValue);
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
             if ($testVal1 < 31 && $testVal2 < 12 && $testVal3 < 12 && strlen($testVal3) == 2) {
542 542
                 $testVal3 += 2000;
543 543
             }
544
-            $PHPDateArray = date_parse($testVal1.'-'.$testVal2.'-'.$testVal3);
544
+            $PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3);
545 545
             if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
546
-                $PHPDateArray = date_parse($testVal2.'-'.$testVal1.'-'.$testVal3);
546
+                $PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3);
547 547
                 if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
548 548
                     return Functions::VALUE();
549 549
                 }
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                 case Functions::RETURNDATE_PHP_NUMERIC:
584 584
                     return (integer) \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue);
585 585
                 case Functions::RETURNDATE_PHP_OBJECT:
586
-                    return new \DateTime($PHPDateArray['year'].'-'.$PHPDateArray['month'].'-'.$PHPDateArray['day'].' 00:00:00');
586
+                    return new \DateTime($PHPDateArray['year'] . '-' . $PHPDateArray['month'] . '-' . $PHPDateArray['day'] . ' 00:00:00');
587 587
             }
588 588
         }
589 589
         return Functions::VALUE();
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $timeValue = str_replace(array('/', '.'), array('-', '-'), $timeValue);
619 619
 
620 620
         $arraySplit = preg_split('/[\/:\-\s]/', $timeValue);
621
-        if ((count($arraySplit) == 2 ||count($arraySplit) == 3) && $arraySplit[0] > 24) {
621
+        if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
622 622
             $arraySplit[0] = ($arraySplit[0] % 24);
623 623
             $timeValue = implode(':', $arraySplit);
624 624
         }
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
                 case Functions::RETURNDATE_EXCEL:
643 643
                     return (float) $excelDateValue;
644 644
                 case Functions::RETURNDATE_PHP_NUMERIC:
645
-                    return (integer) $phpDateValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue+25569) - 3600;
645
+                    return (integer) $phpDateValue = \PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDateValue + 25569) - 3600;
646 646
                 case Functions::RETURNDATE_PHP_OBJECT:
647
-                    return new \DateTime('1900-01-01 '.$PHPDateArray['hour'].':'.$PHPDateArray['minute'].':'.$PHPDateArray['second']);
647
+                    return new \DateTime('1900-01-01 ' . $PHPDateArray['hour'] . ':' . $PHPDateArray['minute'] . ':' . $PHPDateArray['second']);
648 648
             }
649 649
         }
650 650
         return Functions::VALUE();
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             case 'MD':
720 720
                 if ($endDays < $startDays) {
721 721
                     $retVal = $endDays;
722
-                    $PHPEndDateObject->modify('-'.$endDays.' days');
722
+                    $PHPEndDateObject->modify('-' . $endDays . ' days');
723 723
                     $adjustDays = $PHPEndDateObject->format('j');
724 724
                     $retVal += ($adjustDays - $startDays);
725 725
                 } else {
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
      */
788 788
     public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
789 789
     {
790
-        $startDate    = Functions::flattenSingleValue($startDate);
791
-        $endDate    = Functions::flattenSingleValue($endDate);
790
+        $startDate = Functions::flattenSingleValue($startDate);
791
+        $endDate = Functions::flattenSingleValue($endDate);
792 792
 
793 793
         if (is_string($startDate = self::getDateValue($startDate))) {
794 794
             return Functions::VALUE();
@@ -843,9 +843,9 @@  discard block
 block discarded – undo
843 843
      */
844 844
     public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
845 845
     {
846
-        $startDate    = Functions::flattenSingleValue($startDate);
847
-        $endDate    = Functions::flattenSingleValue($endDate);
848
-        $method        = Functions::flattenSingleValue($method);
846
+        $startDate = Functions::flattenSingleValue($startDate);
847
+        $endDate = Functions::flattenSingleValue($endDate);
848
+        $method = Functions::flattenSingleValue($method);
849 849
 
850 850
         if (is_string($startDate = self::getDateValue($startDate))) {
851 851
             return Functions::VALUE();
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
     public static function NETWORKDAYS($startDate, $endDate)
941 941
     {
942 942
         //    Retrieve the mandatory start and end date that are referenced in the function definition
943
-        $startDate    = Functions::flattenSingleValue($startDate);
944
-        $endDate    = Functions::flattenSingleValue($endDate);
943
+        $startDate = Functions::flattenSingleValue($startDate);
944
+        $endDate = Functions::flattenSingleValue($endDate);
945 945
         //    Flush the mandatory start and end date that are referenced in the function definition, and get the optional days
946 946
         $dateArgs = Functions::flattenArray(func_get_args());
947 947
         array_shift($dateArgs);
@@ -1027,8 +1027,8 @@  discard block
 block discarded – undo
1027 1027
     public static function WORKDAY($startDate, $endDays)
1028 1028
     {
1029 1029
         //    Retrieve the mandatory start date and days that are referenced in the function definition
1030
-        $startDate    = Functions::flattenSingleValue($startDate);
1031
-        $endDays    = Functions::flattenSingleValue($endDays);
1030
+        $startDate = Functions::flattenSingleValue($startDate);
1031
+        $endDays = Functions::flattenSingleValue($endDays);
1032 1032
         //    Flush the mandatory start date and days that are referenced in the function definition, and get the optional days
1033 1033
         $dateArgs = Functions::flattenArray(func_get_args());
1034 1034
         array_shift($dateArgs);
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
         $startDoW = self::DAYOFWEEK($startDate, 3);
1052 1052
         if (self::DAYOFWEEK($startDate, 3) >= 5) {
1053
-            $startDate += ($decrementing) ? -$startDoW + 4: 7 - $startDoW;
1053
+            $startDate += ($decrementing) ? -$startDoW + 4 : 7 - $startDoW;
1054 1054
             ($decrementing) ? $endDays++ : $endDays--;
1055 1055
         }
1056 1056
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
         //    Adjust the calculated end date if it falls over a weekend
1061 1061
         $endDoW = self::DAYOFWEEK($endDate, 3);
1062 1062
         if ($endDoW >= 5) {
1063
-            $endDate += ($decrementing) ? -$endDoW + 4: 7 - $endDoW;
1063
+            $endDate += ($decrementing) ? -$endDoW + 4 : 7 - $endDoW;
1064 1064
         }
1065 1065
 
1066 1066
         //    Test any extra holiday parameters
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
      */
1132 1132
     public static function DAYOFMONTH($dateValue = 1)
1133 1133
     {
1134
-        $dateValue    = Functions::flattenSingleValue($dateValue);
1134
+        $dateValue = Functions::flattenSingleValue($dateValue);
1135 1135
 
1136 1136
         if ($dateValue === null) {
1137 1137
             $dateValue = 1;
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
      */
1246 1246
     public static function WEEKOFYEAR($dateValue = 1, $method = 1)
1247 1247
     {
1248
-        $dateValue    = Functions::flattenSingleValue($dateValue);
1249
-        $method        = Functions::flattenSingleValue($method);
1248
+        $dateValue = Functions::flattenSingleValue($dateValue);
1249
+        $method = Functions::flattenSingleValue($method);
1250 1250
 
1251 1251
         if (!is_numeric($method)) {
1252 1252
             return Functions::VALUE();
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
      */
1292 1292
     public static function MONTHOFYEAR($dateValue = 1)
1293 1293
     {
1294
-        $dateValue    = Functions::flattenSingleValue($dateValue);
1294
+        $dateValue = Functions::flattenSingleValue($dateValue);
1295 1295
 
1296 1296
         if (empty($dateValue)) {
1297 1297
             $dateValue = 1;
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
      */
1325 1325
     public static function YEAR($dateValue = 1)
1326 1326
     {
1327
-        $dateValue    = Functions::flattenSingleValue($dateValue);
1327
+        $dateValue = Functions::flattenSingleValue($dateValue);
1328 1328
 
1329 1329
         if ($dateValue === null) {
1330 1330
             $dateValue = 1;
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
      */
1357 1357
     public static function HOUROFDAY($timeValue = 0)
1358 1358
     {
1359
-        $timeValue    = Functions::flattenSingleValue($timeValue);
1359
+        $timeValue = Functions::flattenSingleValue($timeValue);
1360 1360
 
1361 1361
         if (!is_numeric($timeValue)) {
1362 1362
             if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
      */
1398 1398
     public static function MINUTEOFHOUR($timeValue = 0)
1399 1399
     {
1400
-        $timeValue = $timeTester    = Functions::flattenSingleValue($timeValue);
1400
+        $timeValue = $timeTester = Functions::flattenSingleValue($timeValue);
1401 1401
 
1402 1402
         if (!is_numeric($timeValue)) {
1403 1403
             if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
      */
1439 1439
     public static function SECONDOFMINUTE($timeValue = 0)
1440 1440
     {
1441
-        $timeValue    = Functions::flattenSingleValue($timeValue);
1441
+        $timeValue = Functions::flattenSingleValue($timeValue);
1442 1442
 
1443 1443
         if (!is_numeric($timeValue)) {
1444 1444
             if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC) {
@@ -1485,8 +1485,8 @@  discard block
 block discarded – undo
1485 1485
      */
1486 1486
     public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
1487 1487
     {
1488
-        $dateValue            = Functions::flattenSingleValue($dateValue);
1489
-        $adjustmentMonths    = Functions::flattenSingleValue($adjustmentMonths);
1488
+        $dateValue = Functions::flattenSingleValue($dateValue);
1489
+        $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths);
1490 1490
 
1491 1491
         if (!is_numeric($adjustmentMonths)) {
1492 1492
             return Functions::VALUE();
@@ -1531,8 +1531,8 @@  discard block
 block discarded – undo
1531 1531
      */
1532 1532
     public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
1533 1533
     {
1534
-        $dateValue            = Functions::flattenSingleValue($dateValue);
1535
-        $adjustmentMonths    = Functions::flattenSingleValue($adjustmentMonths);
1534
+        $dateValue = Functions::flattenSingleValue($dateValue);
1535
+        $adjustmentMonths = Functions::flattenSingleValue($adjustmentMonths);
1536 1536
 
1537 1537
         if (!is_numeric($adjustmentMonths)) {
1538 1538
             return Functions::VALUE();
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
         }
1545 1545
 
1546 1546
         // Execute function
1547
-        $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths+1);
1547
+        $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths + 1);
1548 1548
         $adjustDays = (int) $PHPDateObject->format('d');
1549 1549
         $adjustDaysString = '-' . $adjustDays . ' days';
1550 1550
         $PHPDateObject->modify($adjustDaysString);
Please login to merge, or discard this patch.