Completed
Push — develop ( 539a89...685e29 )
by Adrien
11:28
created
src/PhpSpreadsheet/Shared/ZipArchive.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,16 +91,16 @@
 block discarded – undo
91 91
     {
92 92
         $filenameParts = pathinfo($localname);
93 93
 
94
-        $handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb");
94
+        $handle = fopen($this->tempDir . '/' . $filenameParts["basename"], "wb");
95 95
         fwrite($handle, $contents);
96 96
         fclose($handle);
97 97
 
98
-        $res = $this->zip->add($this->tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
98
+        $res = $this->zip->add($this->tempDir . '/' . $filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
99 99
         if ($res == 0) {
100 100
             throw new \PHPExcel\Writer\Exception("Error zipping files : " . $this->zip->errorInfo(true));
101 101
         }
102 102
 
103
-        unlink($this->tempDir.'/'.$filenameParts["basename"]);
103
+        unlink($this->tempDir . '/' . $filenameParts["basename"]);
104 104
     }
105 105
 
106 106
     /**
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/OLE/PPS.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
               . \PHPExcel\Shared\OLE::localDateToOLE($this->Time2nd)          // 116
190 190
               . pack("V", isset($this->startBlock) ? $this->startBlock : 0)  // 120
191 191
               . pack("V", $this->Size)               // 124
192
-              . pack("V", 0);                        // 128
192
+              . pack("V", 0); // 128
193 193
         return $ret;
194 194
     }
195 195
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         } elseif (count($to_save) == 1) {
210 210
             $cnt = count($raList);
211 211
             // If the first entry, it's the root... Don't clone it!
212
-            $raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
212
+            $raList[$cnt] = ($depth == 0) ? $to_save[0] : clone $to_save[0];
213 213
             $raList[$cnt]->No = $cnt;
214 214
             $raList[$cnt]->PrevPps = 0xFFFFFFFF;
215 215
             $raList[$cnt]->NextPps = 0xFFFFFFFF;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             $aNext = array_slice($to_save, $iPos + 1);
221 221
             $cnt   = count($raList);
222 222
             // If the first entry, it's the root... Don't clone it!
223
-            $raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
223
+            $raList[$cnt] = ($depth == 0) ? $to_save[$iPos] : clone $to_save[$iPos];
224 224
             $raList[$cnt]->No = $cnt;
225 225
             $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
226 226
             $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/OLE/PPS/Root.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
     public function save($filename)
66 66
     {
67 67
         // Initial Setting for saving
68
-        $this->_BIG_BLOCK_SIZE  = pow(
68
+        $this->_BIG_BLOCK_SIZE = pow(
69 69
             2,
70
-            (isset($this->_BIG_BLOCK_SIZE))? self::adjust2($this->_BIG_BLOCK_SIZE) : 9
70
+            (isset($this->_BIG_BLOCK_SIZE)) ? self::adjust2($this->_BIG_BLOCK_SIZE) : 9
71 71
         );
72
-        $this->_SMALL_BLOCK_SIZE= pow(
72
+        $this->_SMALL_BLOCK_SIZE = pow(
73 73
             2,
74
-            (isset($this->_SMALL_BLOCK_SIZE))?  self::adjust2($this->_SMALL_BLOCK_SIZE) : 6
74
+            (isset($this->_SMALL_BLOCK_SIZE)) ? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6
75 75
         );
76 76
 
77 77
         if (is_resource($filename)) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function _calcSize(&$raList)
127 127
     {
128 128
         // Calculate Basic Setting
129
-        list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
129
+        list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0, 0, 0);
130 130
         $iSmallLen = 0;
131 131
         $iSBcnt = 0;
132 132
         $iCount = count($raList);
@@ -135,21 +135,21 @@  discard block
 block discarded – undo
135 135
                 $raList[$i]->Size = $raList[$i]->getDataLen();
136 136
                 if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) {
137 137
                     $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
138
-                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
138
+                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
139 139
                 } else {
140 140
                     $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
141
-                        (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
141
+                        (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
142 142
                 }
143 143
             }
144 144
         }
145 145
         $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
146 146
         $iSlCnt = floor($this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_LONG_INT_SIZE);
147
-        $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
148
-        $iBBcnt +=  (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
149
-                      (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
147
+        $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0);
148
+        $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
149
+                      (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
150 150
         $iCnt = count($raList);
151 151
         $iBdCnt = $this->_BIG_BLOCK_SIZE / \PHPExcel\Shared\OLE::OLE_PPS_SIZE;
152
-        $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
152
+        $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0));
153 153
 
154 154
         return array($iSBDcnt, $iBBcnt, $iPPScnt);
155 155
     }
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
     */
165 165
     private static function adjust2($i2)
166 166
     {
167
-        $iWk = log($i2)/log(2);
168
-        return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
167
+        $iWk = log($i2) / log(2);
168
+        return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk;
169 169
     }
170 170
 
171 171
     /**
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
         $iBdExL = 0;
188 188
         $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
189 189
         $iAllW = $iAll;
190
-        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
191
-        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
190
+        $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
191
+        $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
192 192
 
193 193
         // Calculate BD count
194 194
         if ($iBdCnt > $i1stBdL) {
195 195
             while (1) {
196 196
                 ++$iBdExL;
197 197
                 ++$iAllW;
198
-                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
199
-                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
200
-                if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
198
+                $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0);
199
+                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0);
200
+                if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) {
201 201
                     break;
202 202
                 }
203 203
             }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             . "\x00\x00\x00\x00"
221 221
             . "\x00\x00\x00\x00"
222 222
             . pack("V", $iBdCnt)
223
-            . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
223
+            . pack("V", $iBBcnt + $iSBDcnt) //ROOT START
224 224
             . pack("V", 0)
225 225
             . pack("V", 0x1000)
226 226
             . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
                 . pack("V", 0)// Extra BDList Count
235 235
             );
236 236
         } else {
237
-            fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
237
+            fwrite($FILE, pack("V", $iAll + $iBdCnt) . pack("V", $iBdExL));
238 238
         }
239 239
 
240 240
         // BDList
241 241
         for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
242
-            fwrite($FILE, pack("V", $iAll+$i));
242
+            fwrite($FILE, pack("V", $iAll + $i));
243 243
         }
244 244
         if ($i < $i1stBdL) {
245 245
             $jB = $i1stBdL - $i;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                     $raList[$i]->startBlock = $iStBlk;
286 286
                     $iStBlk +=
287 287
                             (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
288
-                                (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
288
+                                (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0));
289 289
                 }
290 290
                 // Close file for each PPS, and unlink it
291 291
                 //if (isset($raList[$i]->_PPS_FILE)) {
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
                 }
319 319
                 if ($raList[$i]->Size < \PHPExcel\Shared\OLE::OLE_DATA_SIZE_SMALL) {
320 320
                     $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
321
-                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
321
+                                  + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0);
322 322
                     // Add to SBD
323 323
                     $jB = $iSmbCnt - 1;
324 324
                     for ($j = 0; $j < $jB; ++$j) {
325
-                        fwrite($FILE, pack("V", $j+$iSmBlk+1));
325
+                        fwrite($FILE, pack("V", $j + $iSmBlk + 1));
326 326
                     }
327 327
                     fwrite($FILE, pack("V", -2));
328 328
 
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
         $iBdExL = 0;
394 394
         $iAll = $iBsize + $iPpsCnt + $iSbdSize;
395 395
         $iAllW = $iAll;
396
-        $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
397
-        $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
396
+        $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0);
397
+        $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0);
398 398
         // Calculate BD count
399
-        if ($iBdCnt >$i1stBdL) {
399
+        if ($iBdCnt > $i1stBdL) {
400 400
             while (1) {
401 401
                 ++$iBdExL;
402 402
                 ++$iAllW;
403
-                $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
404
-                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
405
-                if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
403
+                $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0);
404
+                $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0);
405
+                if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) {
406 406
                     break;
407 407
                 }
408 408
             }
@@ -412,19 +412,19 @@  discard block
 block discarded – undo
412 412
         // Set for SBD
413 413
         if ($iSbdSize > 0) {
414 414
             for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
415
-                fwrite($FILE, pack("V", $i+1));
415
+                fwrite($FILE, pack("V", $i + 1));
416 416
             }
417 417
             fwrite($FILE, pack("V", -2));
418 418
         }
419 419
         // Set for B
420 420
         for ($i = 0; $i < ($iBsize - 1); ++$i) {
421
-            fwrite($FILE, pack("V", $i+$iSbdSize+1));
421
+            fwrite($FILE, pack("V", $i + $iSbdSize + 1));
422 422
         }
423 423
         fwrite($FILE, pack("V", -2));
424 424
 
425 425
         // Set for PPS
426 426
         for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
427
-            fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
427
+            fwrite($FILE, pack("V", $i + $iSbdSize + $iBsize + 1));
428 428
         }
429 429
         fwrite($FILE, pack("V", -2));
430 430
         // Set for BBD itself ( 0xFFFFFFFD : BBD)
@@ -444,17 +444,17 @@  discard block
 block discarded – undo
444 444
         }
445 445
         // Extra BDList
446 446
         if ($iBdCnt > $i1stBdL) {
447
-            $iN=0;
448
-            $iNb=0;
447
+            $iN = 0;
448
+            $iNb = 0;
449 449
             for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) {
450 450
                 if ($iN >= ($iBbCnt - 1)) {
451 451
                     $iN = 0;
452 452
                     ++$iNb;
453
-                    fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
453
+                    fwrite($FILE, pack("V", $iAll + $iBdCnt + $iNb));
454 454
                 }
455
-                fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
455
+                fwrite($FILE, pack("V", $iBsize + $iSbdSize + $iPpsCnt + $i));
456 456
             }
457
-            if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
457
+            if (($iBdCnt - $i1stBdL) % ($iBbCnt - 1)) {
458 458
                 $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
459 459
                 for ($i = 0; $i < $iB; ++$i) {
460 460
                     fwrite($FILE, pack("V", -1));
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Trend/PowerBestFit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @var    string
37 37
      **/
38
-    protected $bestFitType        = 'power';
38
+    protected $bestFitType = 'power';
39 39
 
40 40
 
41 41
     /**
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Trend/LogarithmicBestFit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @var    string
37 37
      **/
38
-    protected $bestFitType        = 'logarithmic';
38
+    protected $bestFitType = 'logarithmic';
39 39
 
40 40
     /**
41 41
      * Return the Y-Value for a specified value of X
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $slope = $this->getSlope($dp);
71 71
         $intersect = $this->getIntersect($dp);
72 72
 
73
-        return 'Y = '.$intersect.' + '.$slope.' * log(X)';
73
+        return 'Y = ' . $intersect . ' + ' . $slope . ' * log(X)';
74 74
     }
75 75
 
76 76
     /**
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Trend/LinearBestFit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @var    string
37 37
      **/
38
-    protected $bestFitType        = 'linear';
38
+    protected $bestFitType = 'linear';
39 39
 
40 40
     /**
41 41
      * Return the Y-Value for a specified value of X
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Trend/PolynomialBestFit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 $A[$i][$j] = pow($xValues[$i], $j);
170 170
             }
171 171
         }
172
-        for ($i=0; $i < $this->valueCount; ++$i) {
172
+        for ($i = 0; $i < $this->valueCount; ++$i) {
173 173
             $B[$i] = array($yValues[$i]);
174 174
         }
175 175
         $matrixA = new Matrix($A);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     {
208 208
         if (parent::__construct($yValues, $xValues) !== false) {
209 209
             if ($order < $this->valueCount) {
210
-                $this->bestFitType .= '_'.$order;
210
+                $this->bestFitType .= '_' . $order;
211 211
                 $this->order = $order;
212 212
                 $this->polynomialRegression($order, $yValues, $xValues, $const);
213 213
                 if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Trend/ExponentialBestFit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @var    string
37 37
      **/
38
-    protected $bestFitType        = 'exponential';
38
+    protected $bestFitType = 'exponential';
39 39
 
40 40
     /**
41 41
      * Return the Y-Value for a specified value of X
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/OLE.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 */
41 41
 class OLE
42 42
 {
43
-    const OLE_PPS_TYPE_ROOT   =      5;
44
-    const OLE_PPS_TYPE_DIR    =      1;
45
-    const OLE_PPS_TYPE_FILE   =      2;
43
+    const OLE_PPS_TYPE_ROOT   = 5;
44
+    const OLE_PPS_TYPE_DIR    = 1;
45
+    const OLE_PPS_TYPE_FILE   = 2;
46 46
     const OLE_DATA_SIZE_SMALL = 0x1000;
47
-    const OLE_LONG_INT_SIZE   =      4;
48
-    const OLE_PPS_SIZE        =   0x80;
47
+    const OLE_LONG_INT_SIZE   = 4;
48
+    const OLE_PPS_SIZE        = 0x80;
49 49
 
50 50
     /**
51 51
      * The file handle for reading an OLE container
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         }
117 117
         // Size of blocks and short blocks in bytes
118 118
         $this->bigBlockSize = pow(2, self::_readInt2($fh));
119
-        $this->smallBlockSize  = pow(2, self::_readInt2($fh));
119
+        $this->smallBlockSize = pow(2, self::_readInt2($fh));
120 120
 
121 121
         // Skip UID, revision number and version number
122 122
         fseek($fh, 44);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     public function _readPpsWks($blockId)
270 270
     {
271 271
         $fh = $this->getStream($blockId);
272
-        for ($pos = 0;; $pos += 128) {
272
+        for ($pos = 0; ; $pos += 128) {
273 273
             fseek($fh, $pos, SEEK_SET);
274 274
             $nameUtf16 = fread($fh, 64);
275 275
             $nameLength = self::_readInt2($fh);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         // days from 1-1-1601 until the beggining of UNIX era
474 474
         $days = 134774;
475 475
         // calculate seconds
476
-        $big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
476
+        $big_date = $days * 24 * 3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
477 477
         // multiply just to make MS happy
478 478
         $big_date *= 10000000;
479 479
 
Please login to merge, or discard this patch.