Completed
Push — develop ( 467bab...e1f81f )
by Adrien
10:03
created
src/PhpSpreadsheet/Reader/HTML.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -220,6 +220,11 @@
 block discarded – undo
220 220
         $cellContent = (string) '';
221 221
     }
222 222
 
223
+    /**
224
+     * @param integer $row
225
+     * @param string $column
226
+     * @param string $cellContent
227
+     */
223 228
     protected function processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent, $format = null)
224 229
     {
225 230
         foreach ($element->childNodes as $child) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/ReferenceHelper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -802,7 +802,7 @@
 block discarded – undo
802 802
     /**
803 803
      * Update named formulas (i.e. containing worksheet references / named ranges)
804 804
      *
805
-     * @param PHPExcel $pPhpExcel    Object to update
805
+     * @param Spreadsheet $pPhpExcel    Object to update
806 806
      * @param string $oldName        Old name (name to replace)
807 807
      * @param string $newName        New name
808 808
      */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -450,7 +450,7 @@
 block discarded – undo
450 450
                 if ($cell->getDataType() == Cell\DataType::TYPE_FORMULA) {
451 451
                     // Formula should be adjusted
452 452
                     $pSheet->getCell($newCoordinates)
453
-                           ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
453
+                            ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
454 454
                 } else {
455 455
                     // Formula should not be adjusted
456 456
                     $pSheet->getCell($newCoordinates)->setValue($cell->getValue());
Please login to merge, or discard this patch.
Spacing   +53 added lines, -57 removed lines patch added patch discarded remove patch
@@ -169,8 +169,7 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $aBreaks = $pSheet->getBreaks();
171 171
         ($pNumCols > 0 || $pNumRows > 0) ?
172
-            uksort($aBreaks, array('self','cellReverseSort')) :
173
-            uksort($aBreaks, array('self','cellSort'));
172
+            uksort($aBreaks, array('self', 'cellReverseSort')) : uksort($aBreaks, array('self', 'cellSort'));
174 173
 
175 174
         foreach ($aBreaks as $key => $value) {
176 175
             if (self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
@@ -230,8 +229,7 @@  discard block
 block discarded – undo
230 229
     {
231 230
         $aHyperlinkCollection = $pSheet->getHyperlinkCollection();
232 231
         ($pNumCols > 0 || $pNumRows > 0) ?
233
-            uksort($aHyperlinkCollection, array('self','cellReverseSort')) :
234
-            uksort($aHyperlinkCollection, array('self','cellSort'));
232
+            uksort($aHyperlinkCollection, array('self', 'cellReverseSort')) : uksort($aHyperlinkCollection, array('self', 'cellSort'));
235 233
 
236 234
         foreach ($aHyperlinkCollection as $key => $value) {
237 235
             $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
@@ -256,8 +254,7 @@  discard block
 block discarded – undo
256 254
     {
257 255
         $aDataValidationCollection = $pSheet->getDataValidationCollection();
258 256
         ($pNumCols > 0 || $pNumRows > 0) ?
259
-            uksort($aDataValidationCollection, array('self','cellReverseSort')) :
260
-            uksort($aDataValidationCollection, array('self','cellSort'));
257
+            uksort($aDataValidationCollection, array('self', 'cellReverseSort')) : uksort($aDataValidationCollection, array('self', 'cellSort'));
261 258
         
262 259
         foreach ($aDataValidationCollection as $key => $value) {
263 260
             $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
@@ -303,8 +300,7 @@  discard block
 block discarded – undo
303 300
     {
304 301
         $aProtectedCells = $pSheet->getProtectedCells();
305 302
         ($pNumCols > 0 || $pNumRows > 0) ?
306
-            uksort($aProtectedCells, array('self','cellReverseSort')) :
307
-            uksort($aProtectedCells, array('self','cellSort'));
303
+            uksort($aProtectedCells, array('self', 'cellReverseSort')) : uksort($aProtectedCells, array('self', 'cellSort'));
308 304
         foreach ($aProtectedCells as $key => $value) {
309 305
             $newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
310 306
             if ($key != $newReference) {
@@ -389,13 +385,13 @@  discard block
 block discarded – undo
389 385
 
390 386
         // Get coordinates of $pBefore
391 387
         $beforeColumn    = 'A';
392
-        $beforeRow        = 1;
388
+        $beforeRow = 1;
393 389
         list($beforeColumn, $beforeRow) = Cell::coordinateFromString($pBefore);
394 390
         $beforeColumnIndex = Cell::columnIndexFromString($beforeColumn);
395 391
 
396 392
         // Clear cells if we are removing columns or rows
397
-        $highestColumn    = $pSheet->getHighestColumn();
398
-        $highestRow    = $pSheet->getHighestRow();
393
+        $highestColumn = $pSheet->getHighestColumn();
394
+        $highestRow = $pSheet->getHighestRow();
399 395
 
400 396
         // 1. Clear column strips if we are removing columns
401 397
         if ($pNumCols < 0 && $beforeColumnIndex - 2 + $pNumCols > 0) {
@@ -434,12 +430,12 @@  discard block
 block discarded – undo
434 430
             $cell = $pSheet->getCell($cellID);
435 431
             $cellIndex = Cell::columnIndexFromString($cell->getColumn());
436 432
 
437
-            if ($cellIndex-1 + $pNumCols < 0) {
433
+            if ($cellIndex - 1 + $pNumCols < 0) {
438 434
                 continue;
439 435
             }
440 436
 
441 437
             // New coordinates
442
-            $newCoordinates = Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
438
+            $newCoordinates = Cell::stringFromColumnIndex($cellIndex - 1 + $pNumCols) . ($cell->getRow() + $pNumRows);
443 439
 
444 440
             // Should the cell be updated? Move value and cellXf index from one cell to another.
445 441
             if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) {
@@ -469,8 +465,8 @@  discard block
 block discarded – undo
469 465
         }
470 466
 
471 467
         // Duplicate styles for the newly inserted cells
472
-        $highestColumn    = $pSheet->getHighestColumn();
473
-        $highestRow    = $pSheet->getHighestRow();
468
+        $highestColumn = $pSheet->getHighestColumn();
469
+        $highestRow = $pSheet->getHighestRow();
474 470
 
475 471
         if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
476 472
             for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
@@ -568,23 +564,23 @@  discard block
 block discarded – undo
568 564
                         //    Shuffle columns in autofilter range
569 565
                         if ($pNumCols > 0) {
570 566
                             //    For insert, we shuffle from end to beginning to avoid overwriting
571
-                            $startColID = Cell::stringFromColumnIndex($startCol-1);
572
-                            $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1);
567
+                            $startColID = Cell::stringFromColumnIndex($startCol - 1);
568
+                            $toColID = Cell::stringFromColumnIndex($startCol + $pNumCols - 1);
573 569
                             $endColID = Cell::stringFromColumnIndex($rangeEnd[0]);
574 570
 
575 571
                             $startColRef = $startCol;
576 572
                             $endColRef = $rangeEnd[0];
577
-                            $toColRef = $rangeEnd[0]+$pNumCols;
573
+                            $toColRef = $rangeEnd[0] + $pNumCols;
578 574
 
579 575
                             do {
580
-                                $autoFilter->shiftColumn(Cell::stringFromColumnIndex($endColRef-1), Cell::stringFromColumnIndex($toColRef-1));
576
+                                $autoFilter->shiftColumn(Cell::stringFromColumnIndex($endColRef - 1), Cell::stringFromColumnIndex($toColRef - 1));
581 577
                                 --$endColRef;
582 578
                                 --$toColRef;
583 579
                             } while ($startColRef <= $endColRef);
584 580
                         } else {
585 581
                             //    For delete, we shuffle from beginning to end to avoid overwriting
586
-                            $startColID = Cell::stringFromColumnIndex($startCol-1);
587
-                            $toColID = Cell::stringFromColumnIndex($startCol+$pNumCols-1);
582
+                            $startColID = Cell::stringFromColumnIndex($startCol - 1);
583
+                            $toColID = Cell::stringFromColumnIndex($startCol + $pNumCols - 1);
588 584
                             $endColID = Cell::stringFromColumnIndex($rangeEnd[0]);
589 585
                             do {
590 586
                                 $autoFilter->shiftColumn($startColID, $toColID);
@@ -652,93 +648,93 @@  discard block
 block discarded – undo
652 648
                 $adjustCount = 0;
653 649
                 $newCellTokens = $cellTokens = array();
654 650
                 //    Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)
655
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_ROWRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
651
+                $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_ROWRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER);
656 652
                 if ($matchCount > 0) {
657 653
                     foreach ($matches as $match) {
658
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
659
-                        $fromString .= $match[3].':'.$match[4];
660
-                        $modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2);
661
-                        $modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2);
654
+                        $fromString = ($match[2] > '') ? $match[2] . '!' : '';
655
+                        $fromString .= $match[3] . ':' . $match[4];
656
+                        $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2);
657
+                        $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2);
662 658
 
663
-                        if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
659
+                        if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) {
664 660
                             if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
665
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
666
-                                $toString .= $modified3.':'.$modified4;
661
+                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
662
+                                $toString .= $modified3 . ':' . $modified4;
667 663
                                 //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
668 664
                                 $column = 100000;
669 665
                                 $row = 10000000 + trim($match[3], '$');
670
-                                $cellIndex = $column.$row;
666
+                                $cellIndex = $column . $row;
671 667
 
672 668
                                 $newCellTokens[$cellIndex] = preg_quote($toString);
673
-                                $cellTokens[$cellIndex] = '/(?<!\d\$\!)'.preg_quote($fromString).'(?!\d)/i';
669
+                                $cellTokens[$cellIndex] = '/(?<!\d\$\!)' . preg_quote($fromString) . '(?!\d)/i';
674 670
                                 ++$adjustCount;
675 671
                             }
676 672
                         }
677 673
                     }
678 674
                 }
679 675
                 //    Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
680
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_COLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
676
+                $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_COLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER);
681 677
                 if ($matchCount > 0) {
682 678
                     foreach ($matches as $match) {
683
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
684
-                        $fromString .= $match[3].':'.$match[4];
685
-                        $modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
686
-                        $modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
679
+                        $fromString = ($match[2] > '') ? $match[2] . '!' : '';
680
+                        $fromString .= $match[3] . ':' . $match[4];
681
+                        $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
682
+                        $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
687 683
 
688
-                        if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
684
+                        if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) {
689 685
                             if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
690
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
691
-                                $toString .= $modified3.':'.$modified4;
686
+                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
687
+                                $toString .= $modified3 . ':' . $modified4;
692 688
                                 //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
693 689
                                 $column = Cell::columnIndexFromString(trim($match[3], '$')) + 100000;
694 690
                                 $row = 10000000;
695
-                                $cellIndex = $column.$row;
691
+                                $cellIndex = $column . $row;
696 692
 
697 693
                                 $newCellTokens[$cellIndex] = preg_quote($toString);
698
-                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?![A-Z])/i';
694
+                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?![A-Z])/i';
699 695
                                 ++$adjustCount;
700 696
                             }
701 697
                         }
702 698
                     }
703 699
                 }
704 700
                 //    Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)
705
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLRANGE.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
701
+                $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLRANGE . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER);
706 702
                 if ($matchCount > 0) {
707 703
                     foreach ($matches as $match) {
708
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
709
-                        $fromString .= $match[3].':'.$match[4];
704
+                        $fromString = ($match[2] > '') ? $match[2] . '!' : '';
705
+                        $fromString .= $match[3] . ':' . $match[4];
710 706
                         $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
711 707
                         $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
712 708
 
713
-                        if ($match[3].$match[4] !== $modified3.$modified4) {
709
+                        if ($match[3] . $match[4] !== $modified3 . $modified4) {
714 710
                             if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
715
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
716
-                                $toString .= $modified3.':'.$modified4;
711
+                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
712
+                                $toString .= $modified3 . ':' . $modified4;
717 713
                                 list($column, $row) = Cell::coordinateFromString($match[3]);
718 714
                                 //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
719 715
                                 $column = Cell::columnIndexFromString(trim($column, '$')) + 100000;
720 716
                                 $row = trim($row, '$') + 10000000;
721
-                                $cellIndex = $column.$row;
717
+                                $cellIndex = $column . $row;
722 718
 
723 719
                                 $newCellTokens[$cellIndex] = preg_quote($toString);
724
-                                $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)'.preg_quote($fromString).'(?!\d)/i';
720
+                                $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString) . '(?!\d)/i';
725 721
                                 ++$adjustCount;
726 722
                             }
727 723
                         }
728 724
                     }
729 725
                 }
730 726
                 //    Search for cell references (e.g. 'Sheet1'!A3 or C5) with or without $ absolutes (e.g. $A1 or C$5)
731
-                $matchCount = preg_match_all('/'.self::REFHELPER_REGEXP_CELLREF.'/i', ' '.$formulaBlock.' ', $matches, PREG_SET_ORDER);
727
+                $matchCount = preg_match_all('/' . self::REFHELPER_REGEXP_CELLREF . '/i', ' ' . $formulaBlock . ' ', $matches, PREG_SET_ORDER);
732 728
 
733 729
                 if ($matchCount > 0) {
734 730
                     foreach ($matches as $match) {
735
-                        $fromString = ($match[2] > '') ? $match[2].'!' : '';
731
+                        $fromString = ($match[2] > '') ? $match[2] . '!' : '';
736 732
                         $fromString .= $match[3];
737 733
 
738 734
                         $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
739 735
                         if ($match[3] !== $modified3) {
740 736
                             if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
741
-                                $toString = ($match[2] > '') ? $match[2].'!' : '';
737
+                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
742 738
                                 $toString .= $modified3;
743 739
                                 list($column, $row) = Cell::coordinateFromString($match[3]);
744 740
                                 //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
@@ -747,7 +743,7 @@  discard block
 block discarded – undo
747 743
                                 $cellIndex = $row . $column;
748 744
 
749 745
                                 $newCellTokens[$cellIndex] = preg_quote($toString);
750
-                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])'.preg_quote($fromString).'(?!\d)/i';
746
+                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?!\d)/i';
751 747
                                 ++$adjustCount;
752 748
                             }
753 749
                         }
@@ -847,10 +843,10 @@  discard block
 block discarded – undo
847 843
                 $jc = count($range[$i]);
848 844
                 for ($j = 0; $j < $jc; ++$j) {
849 845
                     if (ctype_alpha($range[$i][$j])) {
850
-                        $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j].'1', $pBefore, $pNumCols, $pNumRows));
846
+                        $r = Cell::coordinateFromString($this->updateSingleCellReference($range[$i][$j] . '1', $pBefore, $pNumCols, $pNumRows));
851 847
                         $range[$i][$j] = $r[0];
852 848
                     } elseif (ctype_digit($range[$i][$j])) {
853
-                        $r = Cell::coordinateFromString($this->updateSingleCellReference('A'.$range[$i][$j], $pBefore, $pNumCols, $pNumRows));
849
+                        $r = Cell::coordinateFromString($this->updateSingleCellReference('A' . $range[$i][$j], $pBefore, $pNumCols, $pNumRows));
854 850
                         $range[$i][$j] = $r[1];
855 851
                     } else {
856 852
                         $range[$i][$j] = $this->updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
@@ -890,12 +886,12 @@  discard block
 block discarded – undo
890 886
 
891 887
             // Create new column reference
892 888
             if ($updateColumn) {
893
-                $newColumn    = Cell::stringFromColumnIndex(Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
889
+                $newColumn = Cell::stringFromColumnIndex(Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
894 890
             }
895 891
 
896 892
             // Create new row reference
897 893
             if ($updateRow) {
898
-                $newRow    = $newRow + $pNumRows;
894
+                $newRow = $newRow + $pNumRows;
899 895
             }
900 896
 
901 897
             // Return new reference
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Drawing.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * Convert pixels to EMU
34 34
      *
35 35
      * @param     int $pValue    Value in pixels
36
-     * @return     int            Value in EMU
36
+     * @return     double            Value in EMU
37 37
      */
38 38
     public static function pixelsToEMU($pValue = 0)
39 39
     {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * Convert pixels to points
115 115
      *
116 116
      * @param     int $pValue    Value in pixels
117
-     * @return     int            Value in points
117
+     * @return     double            Value in points
118 118
      */
119 119
     public static function pixelsToPoints($pValue = 0)
120 120
     {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * Create a new image from file. By alexander at alexauto dot nl
167 167
      *
168 168
      * @link http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214
169
-     * @param string $filename Path to Windows DIB (BMP) image
169
+     * @param string $p_sFile
170 170
      * @return resource
171 171
      */
172 172
     public static function imagecreatefrombmp($p_sFile)
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function degreesToAngle($pValue = 0)
146 146
     {
147
-        return (int)round($pValue * 60000);
147
+        return (int) round($pValue * 60000);
148 148
     }
149 149
 
150 150
     /**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         //    Load the image into a string
175 175
         $file = fopen($p_sFile, "rb");
176 176
         $read = fread($file, 10);
177
-        while (!feof($file) && ($read<>"")) {
177
+        while (!feof($file) && ($read <> "")) {
178 178
             $read .= fread($file, 1024);
179 179
         }
180 180
 
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 
185 185
         //    Process the header
186 186
         //    Structure: http://www.fastgraph.com/help/bmp_header_format.html
187
-        if (substr($header, 0, 4)=="424d") {
187
+        if (substr($header, 0, 4) == "424d") {
188 188
             //    Cut it in parts of 2 bytes
189 189
             $header_parts = str_split($header, 2);
190 190
 
191 191
             //    Get the width        4 bytes
192
-            $width = hexdec($header_parts[19].$header_parts[18]);
192
+            $width = hexdec($header_parts[19] . $header_parts[18]);
193 193
 
194 194
             //    Get the height        4 bytes
195
-            $height = hexdec($header_parts[23].$header_parts[22]);
195
+            $height = hexdec($header_parts[23] . $header_parts[22]);
196 196
 
197 197
             //    Unset the header params
198 198
             unset($header_parts);
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
         //    Calculate if padding at the end-line is needed
212 212
         //    Divided by two to keep overview.
213 213
         //    1 byte = 2 HEX-chars
214
-        $body_size = (strlen($body)/2);
215
-        $header_size = ($width*$height);
214
+        $body_size = (strlen($body) / 2);
215
+        $header_size = ($width * $height);
216 216
 
217 217
         //    Use end-line padding? Only when needed
218
-        $usePadding = ($body_size>($header_size*3)+4);
218
+        $usePadding = ($body_size > ($header_size * 3) + 4);
219 219
 
220 220
         //    Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
221 221
         //    Calculate the next DWORD-position in the body
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 // If padding needed, ignore image-padding
226 226
                 // Shift i to the ending of the current 32-bit-block
227 227
                 if ($usePadding) {
228
-                    $i += $width%4;
228
+                    $i += $width % 4;
229 229
                 }
230 230
 
231 231
                 //    Reset horizontal position
@@ -243,13 +243,13 @@  discard block
 block discarded – undo
243 243
             // Calculation of the RGB-pixel (defined as BGR in image-data)
244 244
             // Define $i_pos as absolute position in the body
245 245
             $i_pos    = $i * 2;
246
-            $r        = hexdec($body[$i_pos+4].$body[$i_pos+5]);
247
-            $g        = hexdec($body[$i_pos+2].$body[$i_pos+3]);
248
-            $b        = hexdec($body[$i_pos].$body[$i_pos+1]);
246
+            $r        = hexdec($body[$i_pos + 4] . $body[$i_pos + 5]);
247
+            $g        = hexdec($body[$i_pos + 2] . $body[$i_pos + 3]);
248
+            $b        = hexdec($body[$i_pos] . $body[$i_pos + 1]);
249 249
 
250 250
             // Calculate and draw the pixel
251 251
             $color    = imagecolorallocate($image, $r, $g, $b);
252
-            imagesetpixel($image, $x, $height-$y, $color);
252
+            imagesetpixel($image, $x, $height - $y, $color);
253 253
 
254 254
             // Raise the horizontal position
255 255
             $x++;
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php 1 patch
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     /**
207 207
      * Get the shape index
208 208
      *
209
-     * @return int
209
+     * @return boolean
210 210
      */
211 211
     public function getSpId()
212 212
     {
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * Set an option for the Shape Group Container
218 218
      *
219 219
      * @param int $property The number specifies the option
220
-     * @param mixed $value
220
+     * @param integer $value
221 221
      */
222 222
     public function setOPT($property, $value)
223 223
     {
@@ -331,7 +331,6 @@  discard block
 block discarded – undo
331 331
     /**
332 332
      * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
333 333
      *
334
-     * @param int $startOffsetX
335 334
      */
336 335
     public function setEndOffsetX($endOffsetX = 0)
337 336
     {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/Font.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      * Calculate an (approximate) OpenXML column width, based on font size and text contained
239 239
      *
240 240
      * @param     \PHPExcel\Style\Font            $font            Font object
241
-     * @param     \PHPExcel\RichText|string    $cellText        Text to calculate width
241
+     * @param     string    $cellText        Text to calculate width
242 242
      * @param     integer                        $rotation        Rotation angle
243 243
      * @param     \PHPExcel\Style\Font|NULL    $defaultFont    Font object
244 244
      * @return     integer        Column width
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      * Calculate an (approximate) pixel size, based on centimeter size
408 408
      *
409 409
      * @param     int        $sizeInCm    Font size (in centimeters)
410
-     * @return     int        Size (in pixels)
410
+     * @return     double        Size (in pixels)
411 411
      */
412 412
     public static function centimeterSizeToPixels($sizeInCm = 1)
413 413
     {
@@ -418,6 +418,7 @@  discard block
 block discarded – undo
418 418
      * Returns the font path given the font
419 419
      *
420 420
      * @param \PHPExcel\Style\Font
421
+     * @param \PHPExcel\Style\Font $font
421 422
      * @return string Path to TrueType font file
422 423
      */
423 424
     public static function getTrueTypeFontFileFromFont($font)
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -144,40 +144,40 @@
 block discarded – undo
144 144
      */
145 145
     public static $defaultColumnWidths = array(
146 146
         'Arial' => array(
147
-             1 => array('px' => 24, 'width' => 12.00000000),
148
-             2 => array('px' => 24, 'width' => 12.00000000),
149
-             3 => array('px' => 32, 'width' => 10.66406250),
150
-             4 => array('px' => 32, 'width' => 10.66406250),
151
-             5 => array('px' => 40, 'width' => 10.00000000),
152
-             6 => array('px' => 48, 'width' =>  9.59765625),
153
-             7 => array('px' => 48, 'width' =>  9.59765625),
154
-             8 => array('px' => 56, 'width' =>  9.33203125),
155
-             9 => array('px' => 64, 'width' =>  9.14062500),
147
+                1 => array('px' => 24, 'width' => 12.00000000),
148
+                2 => array('px' => 24, 'width' => 12.00000000),
149
+                3 => array('px' => 32, 'width' => 10.66406250),
150
+                4 => array('px' => 32, 'width' => 10.66406250),
151
+                5 => array('px' => 40, 'width' => 10.00000000),
152
+                6 => array('px' => 48, 'width' =>  9.59765625),
153
+                7 => array('px' => 48, 'width' =>  9.59765625),
154
+                8 => array('px' => 56, 'width' =>  9.33203125),
155
+                9 => array('px' => 64, 'width' =>  9.14062500),
156 156
             10 => array('px' => 64, 'width' =>  9.14062500),
157 157
         ),
158 158
         'Calibri' => array(
159
-             1 => array('px' => 24, 'width' => 12.00000000),
160
-             2 => array('px' => 24, 'width' => 12.00000000),
161
-             3 => array('px' => 32, 'width' => 10.66406250),
162
-             4 => array('px' => 32, 'width' => 10.66406250),
163
-             5 => array('px' => 40, 'width' => 10.00000000),
164
-             6 => array('px' => 48, 'width' =>  9.59765625),
165
-             7 => array('px' => 48, 'width' =>  9.59765625),
166
-             8 => array('px' => 56, 'width' =>  9.33203125),
167
-             9 => array('px' => 56, 'width' =>  9.33203125),
159
+                1 => array('px' => 24, 'width' => 12.00000000),
160
+                2 => array('px' => 24, 'width' => 12.00000000),
161
+                3 => array('px' => 32, 'width' => 10.66406250),
162
+                4 => array('px' => 32, 'width' => 10.66406250),
163
+                5 => array('px' => 40, 'width' => 10.00000000),
164
+                6 => array('px' => 48, 'width' =>  9.59765625),
165
+                7 => array('px' => 48, 'width' =>  9.59765625),
166
+                8 => array('px' => 56, 'width' =>  9.33203125),
167
+                9 => array('px' => 56, 'width' =>  9.33203125),
168 168
             10 => array('px' => 64, 'width' =>  9.14062500),
169 169
             11 => array('px' => 64, 'width' =>  9.14062500),
170 170
         ),
171 171
         'Verdana' => array(
172
-             1 => array('px' => 24, 'width' => 12.00000000),
173
-             2 => array('px' => 24, 'width' => 12.00000000),
174
-             3 => array('px' => 32, 'width' => 10.66406250),
175
-             4 => array('px' => 32, 'width' => 10.66406250),
176
-             5 => array('px' => 40, 'width' => 10.00000000),
177
-             6 => array('px' => 48, 'width' =>  9.59765625),
178
-             7 => array('px' => 48, 'width' =>  9.59765625),
179
-             8 => array('px' => 64, 'width' =>  9.14062500),
180
-             9 => array('px' => 72, 'width' =>  9.00000000),
172
+                1 => array('px' => 24, 'width' => 12.00000000),
173
+                2 => array('px' => 24, 'width' => 12.00000000),
174
+                3 => array('px' => 32, 'width' => 10.66406250),
175
+                4 => array('px' => 32, 'width' => 10.66406250),
176
+                5 => array('px' => 40, 'width' => 10.00000000),
177
+                6 => array('px' => 48, 'width' =>  9.59765625),
178
+                7 => array('px' => 48, 'width' =>  9.59765625),
179
+                8 => array('px' => 64, 'width' =>  9.14062500),
180
+                9 => array('px' => 72, 'width' =>  9.00000000),
181 181
             10 => array('px' => 72, 'width' =>  9.00000000),
182 182
         ),
183 183
     );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     const CHARSET_ANSI_JAPANESE_SHIFTJIS    = 0x80;
47 47
     const CHARSET_ANSI_KOREAN_HANGUL        = 0x81;
48 48
     const CHARSET_ANSI_KOREAN_JOHAB         = 0x82;
49
-    const CHARSET_ANSI_CHINESE_SIMIPLIFIED  = 0x86;        //    gb2312
50
-    const CHARSET_ANSI_CHINESE_TRADITIONAL  = 0x88;        //    big5
49
+    const CHARSET_ANSI_CHINESE_SIMIPLIFIED  = 0x86; //    gb2312
50
+    const CHARSET_ANSI_CHINESE_TRADITIONAL  = 0x88; //    big5
51 51
     const CHARSET_ANSI_GREEK                = 0xA1;
52 52
     const CHARSET_ANSI_TURKISH              = 0xA2;
53 53
     const CHARSET_ANSI_VIETNAMESE           = 0xA3;
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                 );
513 513
                 break;
514 514
             default:
515
-                throw new \PHPExcel\Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
515
+                throw new \PHPExcel\Exception('Unknown font name "' . $name . '". Cannot map to TrueType font file');
516 516
                 break;
517 517
         }
518 518
 
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
      *    Return the eigenvector matrix
817 817
      *
818 818
      *    @access public
819
-     *    @return V
819
+     *    @return Matrix
820 820
      */
821 821
     public function getV()
822 822
     {
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
      *    Return the block diagonal eigenvalue matrix
850 850
      *
851 851
      *    @access public
852
-     *    @return D
852
+     *    @return Matrix
853 853
      */
854 854
     public function getD()
855 855
     {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,21 +52,21 @@
 block discarded – undo
52 52
     private $V = array();
53 53
 
54 54
     /**
55
-    *    Array for internal storage of nonsymmetric Hessenberg form.
56
-    *    @var array
57
-    */
55
+     *    Array for internal storage of nonsymmetric Hessenberg form.
56
+     *    @var array
57
+     */
58 58
     private $H = array();
59 59
 
60 60
     /**
61
-    *    Working storage for nonsymmetric algorithm.
62
-    *    @var array
63
-    */
61
+     *    Working storage for nonsymmetric algorithm.
62
+     *    @var array
63
+     */
64 64
     private $ort;
65 65
 
66 66
     /**
67
-    *    Used for complex scalar division.
68
-    *    @var float
69
-    */
67
+     *    Used for complex scalar division.
68
+     *    @var float
69
+     */
70 70
     private $cdivr;
71 71
     private $cdivi;
72 72
 
Please login to merge, or discard this patch.
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
         //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
82 82
         //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
83 83
         //  Fortran subroutine in EISPACK.
84
-        $this->d = $this->V[$this->n-1];
84
+        $this->d = $this->V[$this->n - 1];
85 85
         // Householder reduction to tridiagonal form.
86
-        for ($i = $this->n-1; $i > 0; --$i) {
87
-            $i_ = $i -1;
86
+        for ($i = $this->n - 1; $i > 0; --$i) {
87
+            $i_ = $i - 1;
88 88
             // Scale to avoid under/overflow.
89 89
             $h = $scale = 0.0;
90 90
             $scale += array_sum(array_map(abs, $this->d));
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                     $f = $this->d[$j];
117 117
                     $this->V[$j][$i] = $f;
118 118
                     $g = $this->e[$j] + $this->V[$j][$j] * $f;
119
-                    for ($k = $j+1; $k <= $i_; ++$k) {
119
+                    for ($k = $j + 1; $k <= $i_; ++$k) {
120 120
                         $g += $this->V[$k][$j] * $this->d[$k];
121 121
                         $this->e[$k] += $this->V[$k][$j] * $f;
122 122
                     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                     $f += $this->e[$j] * $this->d[$j];
129 129
                 }
130 130
                 $hh = $f / (2 * $h);
131
-                for ($j=0; $j < $i; ++$j) {
131
+                for ($j = 0; $j < $i; ++$j) {
132 132
                     $this->e[$j] -= $hh * $this->d[$j];
133 133
                 }
134 134
                 for ($j = 0; $j < $i; ++$j) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                     for ($k = $j; $k <= $i_; ++$k) {
138 138
                         $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]);
139 139
                     }
140
-                    $this->d[$j] = $this->V[$i-1][$j];
140
+                    $this->d[$j] = $this->V[$i - 1][$j];
141 141
                     $this->V[$i][$j] = 0.0;
142 142
                 }
143 143
             }
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
         }
146 146
 
147 147
         // Accumulate transformations.
148
-        for ($i = 0; $i < $this->n-1; ++$i) {
149
-            $this->V[$this->n-1][$i] = $this->V[$i][$i];
148
+        for ($i = 0; $i < $this->n - 1; ++$i) {
149
+            $this->V[$this->n - 1][$i] = $this->V[$i][$i];
150 150
             $this->V[$i][$i] = 1.0;
151
-            $h = $this->d[$i+1];
151
+            $h = $this->d[$i + 1];
152 152
             if ($h != 0.0) {
153 153
                 for ($k = 0; $k <= $i; ++$k) {
154
-                    $this->d[$k] = $this->V[$k][$i+1] / $h;
154
+                    $this->d[$k] = $this->V[$k][$i + 1] / $h;
155 155
                 }
156 156
                 for ($j = 0; $j <= $i; ++$j) {
157 157
                     $g = 0.0;
158 158
                     for ($k = 0; $k <= $i; ++$k) {
159
-                        $g += $this->V[$k][$i+1] * $this->V[$k][$j];
159
+                        $g += $this->V[$k][$i + 1] * $this->V[$k][$j];
160 160
                     }
161 161
                     for ($k = 0; $k <= $i; ++$k) {
162 162
                         $this->V[$k][$j] -= $g * $this->d[$k];
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
                 }
165 165
             }
166 166
             for ($k = 0; $k <= $i; ++$k) {
167
-                $this->V[$k][$i+1] = 0.0;
167
+                $this->V[$k][$i + 1] = 0.0;
168 168
             }
169 169
         }
170 170
 
171
-        $this->d = $this->V[$this->n-1];
172
-        $this->V[$this->n-1] = array_fill(0, $j, 0.0);
173
-        $this->V[$this->n-1][$this->n-1] = 1.0;
171
+        $this->d = $this->V[$this->n - 1];
172
+        $this->V[$this->n - 1] = array_fill(0, $j, 0.0);
173
+        $this->V[$this->n - 1][$this->n - 1] = 1.0;
174 174
         $this->e[0] = 0.0;
175 175
     }
176 176
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     private function tql2()
188 188
     {
189 189
         for ($i = 1; $i < $this->n; ++$i) {
190
-            $this->e[$i-1] = $this->e[$i];
190
+            $this->e[$i - 1] = $this->e[$i];
191 191
         }
192
-        $this->e[$this->n-1] = 0.0;
192
+        $this->e[$this->n - 1] = 0.0;
193 193
         $f = 0.0;
194 194
         $tst1 = 0.0;
195 195
         $eps  = pow(2.0, -52.0);
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
                     $iter += 1;
214 214
                     // Compute implicit shift
215 215
                     $g = $this->d[$l];
216
-                    $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
216
+                    $p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]);
217 217
                     $r = hypo($p, 1.0);
218 218
                     if ($p < 0) {
219 219
                         $r *= -1;
220 220
                     }
221 221
                     $this->d[$l] = $this->e[$l] / ($p + $r);
222
-                    $this->d[$l+1] = $this->e[$l] * ($p + $r);
223
-                    $dl1 = $this->d[$l+1];
222
+                    $this->d[$l + 1] = $this->e[$l] * ($p + $r);
223
+                    $dl1 = $this->d[$l + 1];
224 224
                     $h = $g - $this->d[$l];
225 225
                     for ($i = $l + 2; $i < $this->n; ++$i) {
226 226
                         $this->d[$i] -= $h;
@@ -232,22 +232,22 @@  discard block
 block discarded – undo
232 232
                     $c2 = $c3 = $c;
233 233
                     $el1 = $this->e[$l + 1];
234 234
                     $s = $s2 = 0.0;
235
-                    for ($i = $m-1; $i >= $l; --$i) {
235
+                    for ($i = $m - 1; $i >= $l; --$i) {
236 236
                         $c3 = $c2;
237 237
                         $c2 = $c;
238 238
                         $s2 = $s;
239 239
                         $g  = $c * $this->e[$i];
240 240
                         $h  = $c * $p;
241 241
                         $r  = hypo($p, $this->e[$i]);
242
-                        $this->e[$i+1] = $s * $r;
242
+                        $this->e[$i + 1] = $s * $r;
243 243
                         $s = $this->e[$i] / $r;
244 244
                         $c = $p / $r;
245 245
                         $p = $c * $this->d[$i] - $s * $g;
246
-                        $this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]);
246
+                        $this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]);
247 247
                         // Accumulate transformation.
248 248
                         for ($k = 0; $k < $this->n; ++$k) {
249
-                            $h = $this->V[$k][$i+1];
250
-                            $this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h;
249
+                            $h = $this->V[$k][$i + 1];
250
+                            $this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h;
251 251
                             $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
252 252
                         }
253 253
                     }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         for ($i = 0; $i < $this->n - 1; ++$i) {
266 266
             $k = $i;
267 267
             $p = $this->d[$i];
268
-            for ($j = $i+1; $j < $this->n; ++$j) {
268
+            for ($j = $i + 1; $j < $this->n; ++$j) {
269 269
                 if ($this->d[$j] < $p) {
270 270
                     $k = $j;
271 271
                     $p = $this->d[$j];
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
     private function orthes()
297 297
     {
298 298
         $low  = 0;
299
-        $high = $this->n-1;
299
+        $high = $this->n - 1;
300 300
 
301
-        for ($m = $low+1; $m <= $high-1; ++$m) {
301
+        for ($m = $low + 1; $m <= $high - 1; ++$m) {
302 302
             // Scale column.
303 303
             $scale = 0.0;
304 304
             for ($i = $m; $i <= $high; ++$i) {
305
-                $scale = $scale + abs($this->H[$i][$m-1]);
305
+                $scale = $scale + abs($this->H[$i][$m - 1]);
306 306
             }
307 307
             if ($scale != 0.0) {
308 308
                 // Compute Householder transformation.
309 309
                 $h = 0.0;
310 310
                 for ($i = $high; $i >= $m; --$i) {
311
-                    $this->ort[$i] = $this->H[$i][$m-1] / $scale;
311
+                    $this->ort[$i] = $this->H[$i][$m - 1] / $scale;
312 312
                     $h += $this->ort[$i] * $this->ort[$i];
313 313
                 }
314 314
                 $g = sqrt($h);
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                     }
341 341
                 }
342 342
                 $this->ort[$m] = $scale * $this->ort[$m];
343
-                $this->H[$m][$m-1] = $scale * $g;
343
+                $this->H[$m][$m - 1] = $scale * $g;
344 344
             }
345 345
         }
346 346
 
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
                 $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0);
351 351
             }
352 352
         }
353
-        for ($m = $high-1; $m >= $low+1; --$m) {
354
-            if ($this->H[$m][$m-1] != 0.0) {
355
-                for ($i = $m+1; $i <= $high; ++$i) {
356
-                    $this->ort[$i] = $this->H[$i][$m-1];
353
+        for ($m = $high - 1; $m >= $low + 1; --$m) {
354
+            if ($this->H[$m][$m - 1] != 0.0) {
355
+                for ($i = $m + 1; $i <= $high; ++$i) {
356
+                    $this->ort[$i] = $this->H[$i][$m - 1];
357 357
                 }
358 358
                 for ($j = $m; $j <= $high; ++$j) {
359 359
                     $g = 0.0;
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                         $g += $this->ort[$i] * $this->V[$i][$j];
362 362
                     }
363 363
                     // Double division avoids possible underflow
364
-                    $g = ($g / $this->ort[$m]) / $this->H[$m][$m-1];
364
+                    $g = ($g / $this->ort[$m]) / $this->H[$m][$m - 1];
365 365
                     for ($i = $m; $i <= $high; ++$i) {
366 366
                         $this->V[$i][$j] += $g * $this->ort[$i];
367 367
                     }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                 $this->d[$i] = $this->H[$i][$i];
419 419
                 $this->e[$i] = 0.0;
420 420
             }
421
-            for ($j = max($i-1, 0); $j < $nn; ++$j) {
421
+            for ($j = max($i - 1, 0); $j < $nn; ++$j) {
422 422
                 $norm = $norm + abs($this->H[$i][$j]);
423 423
             }
424 424
         }
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
             // Look for single small sub-diagonal element
430 430
             $l = $n;
431 431
             while ($l > $low) {
432
-                $s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]);
432
+                $s = abs($this->H[$l - 1][$l - 1]) + abs($this->H[$l][$l]);
433 433
                 if ($s == 0.0) {
434 434
                     $s = $norm;
435 435
                 }
436
-                if (abs($this->H[$l][$l-1]) < $eps * $s) {
436
+                if (abs($this->H[$l][$l - 1]) < $eps * $s) {
437 437
                     break;
438 438
                 }
439 439
                 --$l;
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
                 --$n;
448 448
                 $iter = 0;
449 449
             // Two roots found
450
-            } elseif ($l == $n-1) {
451
-                $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
452
-                $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
450
+            } elseif ($l == $n - 1) {
451
+                $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
452
+                $p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0;
453 453
                 $q = $p * $p + $w;
454 454
                 $z = sqrt(abs($q));
455 455
                 $this->H[$n][$n] = $this->H[$n][$n] + $exshift;
456
-                $this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift;
456
+                $this->H[$n - 1][$n - 1] = $this->H[$n - 1][$n - 1] + $exshift;
457 457
                 $x = $this->H[$n][$n];
458 458
                 // Real pair
459 459
                 if ($q >= 0) {
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
                     } else {
463 463
                         $z = $p - $z;
464 464
                     }
465
-                    $this->d[$n-1] = $x + $z;
466
-                    $this->d[$n] = $this->d[$n-1];
465
+                    $this->d[$n - 1] = $x + $z;
466
+                    $this->d[$n] = $this->d[$n - 1];
467 467
                     if ($z != 0.0) {
468 468
                         $this->d[$n] = $x - $w / $z;
469 469
                     }
470
-                    $this->e[$n-1] = 0.0;
470
+                    $this->e[$n - 1] = 0.0;
471 471
                     $this->e[$n] = 0.0;
472
-                    $x = $this->H[$n][$n-1];
472
+                    $x = $this->H[$n][$n - 1];
473 473
                     $s = abs($x) + abs($z);
474 474
                     $p = $x / $s;
475 475
                     $q = $z / $s;
@@ -477,28 +477,28 @@  discard block
 block discarded – undo
477 477
                     $p = $p / $r;
478 478
                     $q = $q / $r;
479 479
                     // Row modification
480
-                    for ($j = $n-1; $j < $nn; ++$j) {
481
-                        $z = $this->H[$n-1][$j];
482
-                        $this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j];
480
+                    for ($j = $n - 1; $j < $nn; ++$j) {
481
+                        $z = $this->H[$n - 1][$j];
482
+                        $this->H[$n - 1][$j] = $q * $z + $p * $this->H[$n][$j];
483 483
                         $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
484 484
                     }
485 485
                     // Column modification
486 486
                     for ($i = 0; $i <= $n; ++$i) {
487
-                        $z = $this->H[$i][$n-1];
488
-                        $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
487
+                        $z = $this->H[$i][$n - 1];
488
+                        $this->H[$i][$n - 1] = $q * $z + $p * $this->H[$i][$n];
489 489
                         $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
490 490
                     }
491 491
                     // Accumulate transformations
492 492
                     for ($i = $low; $i <= $high; ++$i) {
493
-                        $z = $this->V[$i][$n-1];
494
-                        $this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n];
493
+                        $z = $this->V[$i][$n - 1];
494
+                        $this->V[$i][$n - 1] = $q * $z + $p * $this->V[$i][$n];
495 495
                         $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z;
496 496
                     }
497 497
                 // Complex pair
498 498
                 } else {
499
-                    $this->d[$n-1] = $x + $p;
499
+                    $this->d[$n - 1] = $x + $p;
500 500
                     $this->d[$n] = $x + $p;
501
-                    $this->e[$n-1] = $z;
501
+                    $this->e[$n - 1] = $z;
502 502
                     $this->e[$n] = -$z;
503 503
                 }
504 504
                 $n = $n - 2;
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
                 $y = 0.0;
511 511
                 $w = 0.0;
512 512
                 if ($l < $n) {
513
-                    $y = $this->H[$n-1][$n-1];
514
-                    $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
513
+                    $y = $this->H[$n - 1][$n - 1];
514
+                    $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
515 515
                 }
516 516
                 // Wilkinson's original ad hoc shift
517 517
                 if ($iter == 10) {
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                     for ($i = $low; $i <= $n; ++$i) {
520 520
                         $this->H[$i][$i] -= $x;
521 521
                     }
522
-                    $s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]);
522
+                    $s = abs($this->H[$n][$n - 1]) + abs($this->H[$n - 1][$n - 2]);
523 523
                     $x = $y = 0.75 * $s;
524 524
                     $w = -0.4375 * $s * $s;
525 525
                 }
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
                     $z = $this->H[$m][$m];
549 549
                     $r = $x - $z;
550 550
                     $s = $y - $z;
551
-                    $p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1];
552
-                    $q = $this->H[$m+1][$m+1] - $z - $r - $s;
553
-                    $r = $this->H[$m+2][$m+1];
551
+                    $p = ($r * $s - $w) / $this->H[$m + 1][$m] + $this->H[$m][$m + 1];
552
+                    $q = $this->H[$m + 1][$m + 1] - $z - $r - $s;
553
+                    $r = $this->H[$m + 2][$m + 1];
554 554
                     $s = abs($p) + abs($q) + abs($r);
555 555
                     $p = $p / $s;
556 556
                     $q = $q / $s;
@@ -558,25 +558,25 @@  discard block
 block discarded – undo
558 558
                     if ($m == $l) {
559 559
                         break;
560 560
                     }
561
-                    if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) <
562
-                        $eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) {
561
+                    if (abs($this->H[$m][$m - 1]) * (abs($q) + abs($r)) <
562
+                        $eps * (abs($p) * (abs($this->H[$m - 1][$m - 1]) + abs($z) + abs($this->H[$m + 1][$m + 1])))) {
563 563
                         break;
564 564
                     }
565 565
                     --$m;
566 566
                 }
567 567
                 for ($i = $m + 2; $i <= $n; ++$i) {
568
-                    $this->H[$i][$i-2] = 0.0;
569
-                    if ($i > $m+2) {
570
-                        $this->H[$i][$i-3] = 0.0;
568
+                    $this->H[$i][$i - 2] = 0.0;
569
+                    if ($i > $m + 2) {
570
+                        $this->H[$i][$i - 3] = 0.0;
571 571
                     }
572 572
                 }
573 573
                 // Double QR step involving rows l:n and columns m:n
574
-                for ($k = $m; $k <= $n-1; ++$k) {
575
-                    $notlast = ($k != $n-1);
574
+                for ($k = $m; $k <= $n - 1; ++$k) {
575
+                    $notlast = ($k != $n - 1);
576 576
                     if ($k != $m) {
577
-                        $p = $this->H[$k][$k-1];
578
-                        $q = $this->H[$k+1][$k-1];
579
-                        $r = ($notlast ? $this->H[$k+2][$k-1] : 0.0);
577
+                        $p = $this->H[$k][$k - 1];
578
+                        $q = $this->H[$k + 1][$k - 1];
579
+                        $r = ($notlast ? $this->H[$k + 2][$k - 1] : 0.0);
580 580
                         $x = abs($p) + abs($q) + abs($r);
581 581
                         if ($x != 0.0) {
582 582
                             $p = $p / $x;
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
                     }
594 594
                     if ($s != 0) {
595 595
                         if ($k != $m) {
596
-                            $this->H[$k][$k-1] = -$s * $x;
596
+                            $this->H[$k][$k - 1] = -$s * $x;
597 597
                         } elseif ($l != $m) {
598
-                            $this->H[$k][$k-1] = -$this->H[$k][$k-1];
598
+                            $this->H[$k][$k - 1] = -$this->H[$k][$k - 1];
599 599
                         }
600 600
                         $p = $p + $s;
601 601
                         $x = $p / $s;
@@ -605,33 +605,33 @@  discard block
 block discarded – undo
605 605
                         $r = $r / $p;
606 606
                         // Row modification
607 607
                         for ($j = $k; $j < $nn; ++$j) {
608
-                            $p = $this->H[$k][$j] + $q * $this->H[$k+1][$j];
608
+                            $p = $this->H[$k][$j] + $q * $this->H[$k + 1][$j];
609 609
                             if ($notlast) {
610
-                                $p = $p + $r * $this->H[$k+2][$j];
611
-                                $this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z;
610
+                                $p = $p + $r * $this->H[$k + 2][$j];
611
+                                $this->H[$k + 2][$j] = $this->H[$k + 2][$j] - $p * $z;
612 612
                             }
613 613
                             $this->H[$k][$j] = $this->H[$k][$j] - $p * $x;
614
-                            $this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y;
614
+                            $this->H[$k + 1][$j] = $this->H[$k + 1][$j] - $p * $y;
615 615
                         }
616 616
                         // Column modification
617
-                        for ($i = 0; $i <= min($n, $k+3); ++$i) {
618
-                            $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1];
617
+                        for ($i = 0; $i <= min($n, $k + 3); ++$i) {
618
+                            $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k + 1];
619 619
                             if ($notlast) {
620
-                                $p = $p + $z * $this->H[$i][$k+2];
621
-                                $this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r;
620
+                                $p = $p + $z * $this->H[$i][$k + 2];
621
+                                $this->H[$i][$k + 2] = $this->H[$i][$k + 2] - $p * $r;
622 622
                             }
623 623
                             $this->H[$i][$k] = $this->H[$i][$k] - $p;
624
-                            $this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q;
624
+                            $this->H[$i][$k + 1] = $this->H[$i][$k + 1] - $p * $q;
625 625
                         }
626 626
                         // Accumulate transformations
627 627
                         for ($i = $low; $i <= $high; ++$i) {
628
-                            $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1];
628
+                            $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k + 1];
629 629
                             if ($notlast) {
630
-                                $p = $p + $z * $this->V[$i][$k+2];
631
-                                $this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r;
630
+                                $p = $p + $z * $this->V[$i][$k + 2];
631
+                                $this->V[$i][$k + 2] = $this->V[$i][$k + 2] - $p * $r;
632 632
                             }
633 633
                             $this->V[$i][$k] = $this->V[$i][$k] - $p;
634
-                            $this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q;
634
+                            $this->V[$i][$k + 1] = $this->V[$i][$k + 1] - $p * $q;
635 635
                         }
636 636
                     }  // ($s != 0)
637 637
                 }  // k loop
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
             return;
644 644
         }
645 645
 
646
-        for ($n = $nn-1; $n >= 0; --$n) {
646
+        for ($n = $nn - 1; $n >= 0; --$n) {
647 647
             $p = $this->d[$n];
648 648
             $q = $this->e[$n];
649 649
             // Real vector
650 650
             if ($q == 0) {
651 651
                 $l = $n;
652 652
                 $this->H[$n][$n] = 1.0;
653
-                for ($i = $n-1; $i >= 0; --$i) {
653
+                for ($i = $n - 1; $i >= 0; --$i) {
654 654
                     $w = $this->H[$i][$i] - $p;
655 655
                     $r = 0.0;
656 656
                     for ($j = $l; $j <= $n; ++$j) {
@@ -669,15 +669,15 @@  discard block
 block discarded – undo
669 669
                             }
670 670
                         // Solve real equations
671 671
                         } else {
672
-                            $x = $this->H[$i][$i+1];
673
-                            $y = $this->H[$i+1][$i];
672
+                            $x = $this->H[$i][$i + 1];
673
+                            $y = $this->H[$i + 1][$i];
674 674
                             $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i];
675 675
                             $t = ($x * $s - $z * $r) / $q;
676 676
                             $this->H[$i][$n] = $t;
677 677
                             if (abs($x) > abs($z)) {
678
-                                $this->H[$i+1][$n] = (-$r - $w * $t) / $x;
678
+                                $this->H[$i + 1][$n] = (-$r - $w * $t) / $x;
679 679
                             } else {
680
-                                $this->H[$i+1][$n] = (-$s - $y * $t) / $z;
680
+                                $this->H[$i + 1][$n] = (-$s - $y * $t) / $z;
681 681
                             }
682 682
                         }
683 683
                         // Overflow control
@@ -691,24 +691,24 @@  discard block
 block discarded – undo
691 691
                 }
692 692
             // Complex vector
693 693
             } elseif ($q < 0) {
694
-                $l = $n-1;
694
+                $l = $n - 1;
695 695
                 // Last vector component imaginary so matrix is triangular
696
-                if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
697
-                    $this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1];
698
-                    $this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1];
696
+                if (abs($this->H[$n][$n - 1]) > abs($this->H[$n - 1][$n])) {
697
+                    $this->H[$n - 1][$n - 1] = $q / $this->H[$n][$n - 1];
698
+                    $this->H[$n - 1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n - 1];
699 699
                 } else {
700
-                    $this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q);
701
-                    $this->H[$n-1][$n-1] = $this->cdivr;
702
-                    $this->H[$n-1][$n]   = $this->cdivi;
700
+                    $this->cdiv(0.0, -$this->H[$n - 1][$n], $this->H[$n - 1][$n - 1] - $p, $q);
701
+                    $this->H[$n - 1][$n - 1] = $this->cdivr;
702
+                    $this->H[$n - 1][$n]   = $this->cdivi;
703 703
                 }
704
-                $this->H[$n][$n-1] = 0.0;
704
+                $this->H[$n][$n - 1] = 0.0;
705 705
                 $this->H[$n][$n] = 1.0;
706
-                for ($i = $n-2; $i >= 0; --$i) {
706
+                for ($i = $n - 2; $i >= 0; --$i) {
707 707
                     // double ra,sa,vr,vi;
708 708
                     $ra = 0.0;
709 709
                     $sa = 0.0;
710 710
                     for ($j = $l; $j <= $n; ++$j) {
711
-                        $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1];
711
+                        $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n - 1];
712 712
                         $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n];
713 713
                     }
714 714
                     $w = $this->H[$i][$i] - $p;
@@ -720,34 +720,34 @@  discard block
 block discarded – undo
720 720
                         $l = $i;
721 721
                         if ($this->e[$i] == 0) {
722 722
                             $this->cdiv(-$ra, -$sa, $w, $q);
723
-                            $this->H[$i][$n-1] = $this->cdivr;
723
+                            $this->H[$i][$n - 1] = $this->cdivr;
724 724
                             $this->H[$i][$n]   = $this->cdivi;
725 725
                         } else {
726 726
                             // Solve complex equations
727
-                            $x = $this->H[$i][$i+1];
728
-                            $y = $this->H[$i+1][$i];
727
+                            $x = $this->H[$i][$i + 1];
728
+                            $y = $this->H[$i + 1][$i];
729 729
                             $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q;
730 730
                             $vi = ($this->d[$i] - $p) * 2.0 * $q;
731 731
                             if ($vr == 0.0 & $vi == 0.0) {
732 732
                                 $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z));
733 733
                             }
734 734
                             $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi);
735
-                            $this->H[$i][$n-1] = $this->cdivr;
735
+                            $this->H[$i][$n - 1] = $this->cdivr;
736 736
                             $this->H[$i][$n]   = $this->cdivi;
737 737
                             if (abs($x) > (abs($z) + abs($q))) {
738
-                                $this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x;
739
-                                $this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x;
738
+                                $this->H[$i + 1][$n - 1] = (-$ra - $w * $this->H[$i][$n - 1] + $q * $this->H[$i][$n]) / $x;
739
+                                $this->H[$i + 1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n - 1]) / $x;
740 740
                             } else {
741
-                                $this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q);
742
-                                $this->H[$i+1][$n-1] = $this->cdivr;
743
-                                $this->H[$i+1][$n]   = $this->cdivi;
741
+                                $this->cdiv(-$r - $y * $this->H[$i][$n - 1], -$s - $y * $this->H[$i][$n], $z, $q);
742
+                                $this->H[$i + 1][$n - 1] = $this->cdivr;
743
+                                $this->H[$i + 1][$n]   = $this->cdivi;
744 744
                             }
745 745
                         }
746 746
                         // Overflow control
747
-                        $t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
747
+                        $t = max(abs($this->H[$i][$n - 1]), abs($this->H[$i][$n]));
748 748
                         if (($eps * $t) * $t > 1) {
749 749
                             for ($j = $i; $j <= $n; ++$j) {
750
-                                $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
750
+                                $this->H[$j][$n - 1] = $this->H[$j][$n - 1] / $t;
751 751
                                 $this->H[$j][$n]   = $this->H[$j][$n] / $t;
752 752
                             }
753 753
                         }
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         }
767 767
 
768 768
         // Back transformation to get eigenvectors of original matrix
769
-        for ($j = $nn-1; $j >= $low; --$j) {
769
+        for ($j = $nn - 1; $j >= $low; --$j) {
770 770
             for ($i = $low; $i <= $high; ++$i) {
771 771
                 $z = 0.0;
772 772
                 for ($k = $low; $k <= min($j, $high); ++$k) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      *    LU Decomposition constructor.
61 61
      *
62
-     *    @param $A Rectangular matrix
62
+     *    @param Matrix $A Rectangular matrix
63 63
      *    @return Structure to access L, U and piv.
64 64
      */
65 65
     public function __construct($A)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     /**
126 126
      *    Get lower triangular factor.
127 127
      *
128
-     *    @return array Lower triangular factor
128
+     *    @return Matrix Lower triangular factor
129 129
      */
130 130
     public function getL()
131 131
     {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      *    Get upper triangular factor.
148 148
      *
149
-     *    @return array Upper triangular factor
149
+     *    @return Matrix Upper triangular factor
150 150
      */
151 151
     public function getU()
152 152
     {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     /**
186 186
      *    Is the matrix nonsingular?
187 187
      *
188
-     *    @return true if U, and hence A, is nonsingular.
188
+     *    @return boolean if U, and hence A, is nonsingular.
189 189
      */
190 190
     public function isNonsingular()
191 191
     {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     /**
219 219
      *    Solve A*X = B
220 220
      *
221
-     *    @param  $B  A Matrix with as many rows as A and any number of columns.
221
+     *    @param  Matrix $B  A Matrix with as many rows as A and any number of columns.
222 222
      *    @return  X so that L*U*X = B(piv,:)
223 223
      *    @\PHPExcel\Calculation\Exception  IllegalArgumentException Matrix row dimensions must agree.
224 224
      *    @\PHPExcel\Calculation\Exception  RuntimeException  Matrix is singular.
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 }
95 95
                 // Find pivot and exchange if necessary.
96 96
                 $p = $j;
97
-                for ($i = $j+1; $i < $this->m; ++$i) {
97
+                for ($i = $j + 1; $i < $this->m; ++$i) {
98 98
                     if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
99 99
                         $p = $i;
100 100
                     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                 }
113 113
                 // Compute multipliers.
114 114
                 if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
115
-                    for ($i = $j+1; $i < $this->m; ++$i) {
115
+                    for ($i = $j + 1; $i < $this->m; ++$i) {
116 116
                         $this->LU[$i][$j] /= $this->LU[$j][$j];
117 117
                     }
118 118
                 }
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
             if ($this->isNonsingular()) {
230 230
                 // Copy right hand side with pivoting
231 231
                 $nx = $B->getColumnDimension();
232
-                $X  = $B->getMatrix($this->piv, 0, $nx-1);
232
+                $X  = $B->getMatrix($this->piv, 0, $nx - 1);
233 233
                 // Solve L*Y = B(piv,:)
234 234
                 for ($k = 0; $k < $this->n; ++$k) {
235
-                    for ($i = $k+1; $i < $this->n; ++$i) {
235
+                    for ($i = $k + 1; $i < $this->n; ++$i) {
236 236
                         for ($j = 0; $j < $nx; ++$j) {
237 237
                             $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
238 238
                         }
239 239
                     }
240 240
                 }
241 241
                 // Solve U*X = Y;
242
-                for ($k = $this->n-1; $k >= 0; --$k) {
242
+                for ($k = $this->n - 1; $k >= 0; --$k) {
243 243
                     for ($j = 0; $j < $nx; ++$j) {
244 244
                         $X->A[$k][$j] /= $this->LU[$k][$k];
245 245
                     }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/Matrix.php 2 patches
Doc Comments   +2 added lines, -36 removed lines patch added patch discarded remove patch
@@ -149,11 +149,6 @@  discard block
 block discarded – undo
149 149
      *    getMatrix
150 150
      *
151 151
      *    Get a submatrix
152
-     *    @param int $i0 Initial row index
153
-     *    @param int $iF Final row index
154
-     *    @param int $j0 Initial column index
155
-     *    @param int $jF Final column index
156
-     *    @return Matrix Submatrix
157 152
      */
158 153
     public function getMatrix()
159 154
     {
@@ -351,7 +346,7 @@  discard block
 block discarded – undo
351 346
      *    Generate a diagonal matrix
352 347
      *    @param int $m Row dimension
353 348
      *    @param int $n Column dimension
354
-     *    @param mixed $c Diagonal value
349
+     *    @param integer $c Diagonal value
355 350
      *    @return Matrix Diagonal matrix
356 351
      */
357 352
     public function diagonal($m = null, $n = null, $c = 1)
@@ -388,9 +383,6 @@  discard block
 block discarded – undo
388 383
      *    getMatrixByCol
389 384
      *
390 385
      *    Get a submatrix by column index/range
391
-     *    @param int $i0 Initial column index
392
-     *    @param int $iF Final column index
393
-     *    @return Matrix Submatrix
394 386
      */
395 387
     public function getMatrixByCol($j0 = null, $jF = null)
396 388
     {
@@ -426,7 +418,7 @@  discard block
 block discarded – undo
426 418
      *    trace
427 419
      *
428 420
      *    Sum of diagonal elements
429
-     *    @return float Sum of diagonal elements
421
+     *    @return integer Sum of diagonal elements
430 422
      */
431 423
     public function trace()
432 424
     {
@@ -452,8 +444,6 @@  discard block
 block discarded – undo
452 444
      *    plus
453 445
      *
454 446
      *    A + B
455
-     *    @param mixed $B Matrix/Array
456
-     *    @return Matrix Sum
457 447
      */
458 448
     public function plus()
459 449
     {
@@ -492,8 +482,6 @@  discard block
 block discarded – undo
492 482
      *    plusEquals
493 483
      *
494 484
      *    A = A + B
495
-     *    @param mixed $B Matrix/Array
496
-     *    @return Matrix Sum
497 485
      */
498 486
     public function plusEquals()
499 487
     {
@@ -546,8 +534,6 @@  discard block
 block discarded – undo
546 534
      *    minus
547 535
      *
548 536
      *    A - B
549
-     *    @param mixed $B Matrix/Array
550
-     *    @return Matrix Sum
551 537
      */
552 538
     public function minus()
553 539
     {
@@ -586,8 +572,6 @@  discard block
 block discarded – undo
586 572
      *    minusEquals
587 573
      *
588 574
      *    A = A - B
589
-     *    @param mixed $B Matrix/Array
590
-     *    @return Matrix Sum
591 575
      */
592 576
     public function minusEquals()
593 577
     {
@@ -641,8 +625,6 @@  discard block
 block discarded – undo
641 625
      *
642 626
      *    Element-by-element multiplication
643 627
      *    Cij = Aij * Bij
644
-     *    @param mixed $B Matrix/Array
645
-     *    @return Matrix Matrix Cij
646 628
      */
647 629
     public function arrayTimes()
648 630
     {
@@ -682,8 +664,6 @@  discard block
 block discarded – undo
682 664
      *
683 665
      *    Element-by-element multiplication
684 666
      *    Aij = Aij * Bij
685
-     *    @param mixed $B Matrix/Array
686
-     *    @return Matrix Matrix Aij
687 667
      */
688 668
     public function arrayTimesEquals()
689 669
     {
@@ -737,8 +717,6 @@  discard block
 block discarded – undo
737 717
      *
738 718
      *    Element-by-element right division
739 719
      *    A / B
740
-     *    @param Matrix $B Matrix B
741
-     *    @return Matrix Division result
742 720
      */
743 721
     public function arrayRightDivide()
744 722
     {
@@ -798,8 +776,6 @@  discard block
 block discarded – undo
798 776
      *
799 777
      *    Element-by-element right division
800 778
      *    Aij = Aij / Bij
801
-     *    @param mixed $B Matrix/Array
802
-     *    @return Matrix Matrix Aij
803 779
      */
804 780
     public function arrayRightDivideEquals()
805 781
     {
@@ -840,8 +816,6 @@  discard block
 block discarded – undo
840 816
      *
841 817
      *    Element-by-element Left division
842 818
      *    A / B
843
-     *    @param Matrix $B Matrix B
844
-     *    @return Matrix Division result
845 819
      */
846 820
     public function arrayLeftDivide()
847 821
     {
@@ -882,8 +856,6 @@  discard block
 block discarded – undo
882 856
      *
883 857
      *    Element-by-element Left division
884 858
      *    Aij = Aij / Bij
885
-     *    @param mixed $B Matrix/Array
886
-     *    @return Matrix Matrix Aij
887 859
      */
888 860
     public function arrayLeftDivideEquals()
889 861
     {
@@ -923,8 +895,6 @@  discard block
 block discarded – undo
923 895
      *    times
924 896
      *
925 897
      *    Matrix multiplication
926
-     *    @param mixed $n Matrix/Array/Scalar
927
-     *    @return Matrix Product
928 898
      */
929 899
     public function times()
930 900
     {
@@ -1018,8 +988,6 @@  discard block
 block discarded – undo
1018 988
      *    power
1019 989
      *
1020 990
      *    A = A ^ B
1021
-     *    @param mixed $B Matrix/Array
1022
-     *    @return Matrix Sum
1023 991
      */
1024 992
     public function power()
1025 993
     {
@@ -1072,8 +1040,6 @@  discard block
 block discarded – undo
1072 1040
      *    concat
1073 1041
      *
1074 1042
      *    A = A & B
1075
-     *    @param mixed $B Matrix/Array
1076
-     *    @return Matrix Sum
1077 1043
      */
1078 1044
     public function concat()
1079 1045
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                     } else {
197 197
                         throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
198 198
                     }
199
-                    $R = new Matrix($m+1, $n+1);
199
+                    $R = new Matrix($m + 1, $n + 1);
200 200
                     for ($i = $i0; $i <= $iF; ++$i) {
201 201
                         for ($j = $j0; $j <= $jF; ++$j) {
202 202
                             $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                     } else {
281 281
                         throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
282 282
                     }
283
-                    $R = new Matrix($m, $n+1);
283
+                    $R = new Matrix($m, $n + 1);
284 284
                     for ($i = 0; $i < $m; ++$i) {
285 285
                         for ($j = $j0; $j <= $jF; ++$j) {
286 286
                             $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
             $this->checkMatrixDimensions($M);
1100 1100
             for ($i = 0; $i < $this->m; ++$i) {
1101 1101
                 for ($j = 0; $j < $this->n; ++$j) {
1102
-                    $this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
1102
+                    $this->A[$i][$j] = trim($this->A[$i][$j], '"') . trim($M->get($i, $j), '"');
1103 1103
                 }
1104 1104
             }
1105 1105
             return $this;
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
      *    Return the left singular vectors
437 437
      *
438 438
      *    @access public
439
-     *    @return U
439
+     *    @return Matrix
440 440
      */
441 441
     public function getU()
442 442
     {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      *    Return the right singular vectors
449 449
      *
450 450
      *    @access public
451
-     *    @return V
451
+     *    @return Matrix
452 452
      */
453 453
     public function getV()
454 454
     {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      *    Return the diagonal matrix of singular values
473 473
      *
474 474
      *    @access public
475
-     *    @return S
475
+     *    @return Matrix
476 476
      */
477 477
     public function getS()
478 478
     {
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -131,27 +131,27 @@  discard block
 block discarded – undo
131 131
                     $e[$k] = hypo($e[$k], $e[$i]);
132 132
                 }
133 133
                 if ($e[$k] != 0.0) {
134
-                    if ($e[$k+1] < 0.0) {
134
+                    if ($e[$k + 1] < 0.0) {
135 135
                         $e[$k] = -$e[$k];
136 136
                     }
137 137
                     for ($i = $k + 1; $i < $this->n; ++$i) {
138 138
                         $e[$i] /= $e[$k];
139 139
                     }
140
-                    $e[$k+1] += 1.0;
140
+                    $e[$k + 1] += 1.0;
141 141
                 }
142 142
                 $e[$k] = -$e[$k];
143
-                if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
143
+                if (($k + 1 < $this->m) and ($e[$k] != 0.0)) {
144 144
                     // Apply the transformation.
145
-                    for ($i = $k+1; $i < $this->m; ++$i) {
145
+                    for ($i = $k + 1; $i < $this->m; ++$i) {
146 146
                         $work[$i] = 0.0;
147 147
                     }
148
-                    for ($j = $k+1; $j < $this->n; ++$j) {
149
-                        for ($i = $k+1; $i < $this->m; ++$i) {
148
+                    for ($j = $k + 1; $j < $this->n; ++$j) {
149
+                        for ($i = $k + 1; $i < $this->m; ++$i) {
150 150
                             $work[$i] += $e[$j] * $A[$i][$j];
151 151
                         }
152 152
                     }
153 153
                     for ($j = $k + 1; $j < $this->n; ++$j) {
154
-                        $t = -$e[$j] / $e[$k+1];
154
+                        $t = -$e[$j] / $e[$k + 1];
155 155
                         for ($i = $k + 1; $i < $this->m; ++$i) {
156 156
                             $A[$i][$j] += $t * $work[$i];
157 157
                         }
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
             $this->s[$nct] = $A[$nct][$nct];
174 174
         }
175 175
         if ($this->m < $p) {
176
-            $this->s[$p-1] = 0.0;
176
+            $this->s[$p - 1] = 0.0;
177 177
         }
178 178
         if ($nrt + 1 < $p) {
179
-            $e[$nrt] = $A[$nrt][$p-1];
179
+            $e[$nrt] = $A[$nrt][$p - 1];
180 180
         }
181
-        $e[$p-1] = 0.0;
181
+        $e[$p - 1] = 0.0;
182 182
         // If required, generate U.
183 183
         if ($wantu) {
184 184
             for ($j = $nct; $j < $nu; ++$j) {
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
                     for ($j = $k + 1; $j < $nu; ++$j) {
223 223
                         $t = 0;
224 224
                         for ($i = $k + 1; $i < $this->n; ++$i) {
225
-                            $t += $this->V[$i][$k]* $this->V[$i][$j];
225
+                            $t += $this->V[$i][$k] * $this->V[$i][$j];
226 226
                         }
227
-                        $t = -$t / $this->V[$k+1][$k];
227
+                        $t = -$t / $this->V[$k + 1][$k];
228 228
                         for ($i = $k + 1; $i < $this->n; ++$i) {
229 229
                             $this->V[$i][$j] += $t * $this->V[$i][$k];
230 230
                         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 if ($k == -1) {
257 257
                     break;
258 258
                 }
259
-                if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) {
259
+                if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k + 1]))) {
260 260
                     $e[$k] = 0.0;
261 261
                     break;
262 262
                 }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     if ($ks == $k) {
269 269
                         break;
270 270
                     }
271
-                    $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
271
+                    $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks - 1]) : 0.);
272 272
                     if (abs($this->s[$ks]) <= $eps * $t) {
273 273
                         $this->s[$ks] = 0.0;
274 274
                         break;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                 }
277 277
                 if ($ks == $k) {
278 278
                     $kase = 3;
279
-                } elseif ($ks == $p-1) {
279
+                } elseif ($ks == $p - 1) {
280 280
                     $kase = 1;
281 281
                 } else {
282 282
                     $kase = 2;
@@ -289,21 +289,21 @@  discard block
 block discarded – undo
289 289
             switch ($kase) {
290 290
                 // Deflate negligible s(p).
291 291
                 case 1:
292
-                    $f = $e[$p-2];
293
-                    $e[$p-2] = 0.0;
292
+                    $f = $e[$p - 2];
293
+                    $e[$p - 2] = 0.0;
294 294
                     for ($j = $p - 2; $j >= $k; --$j) {
295 295
                         $t  = hypo($this->s[$j], $f);
296 296
                         $cs = $this->s[$j] / $t;
297 297
                         $sn = $f / $t;
298 298
                         $this->s[$j] = $t;
299 299
                         if ($j != $k) {
300
-                            $f = -$sn * $e[$j-1];
301
-                            $e[$j-1] = $cs * $e[$j-1];
300
+                            $f = -$sn * $e[$j - 1];
301
+                            $e[$j - 1] = $cs * $e[$j - 1];
302 302
                         }
303 303
                         if ($wantv) {
304 304
                             for ($i = 0; $i < $this->n; ++$i) {
305
-                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
306
-                                $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
305
+                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p - 1];
306
+                                $this->V[$i][$p - 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p - 1];
307 307
                                 $this->V[$i][$j] = $t;
308 308
                             }
309 309
                         }
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
                     break;
312 312
                 // Split at negligible s(k).
313 313
                 case 2:
314
-                    $f = $e[$k-1];
315
-                    $e[$k-1] = 0.0;
314
+                    $f = $e[$k - 1];
315
+                    $e[$k - 1] = 0.0;
316 316
                     for ($j = $k; $j < $p; ++$j) {
317 317
                         $t = hypo($this->s[$j], $f);
318 318
                         $cs = $this->s[$j] / $t;
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
                         $e[$j] = $cs * $e[$j];
323 323
                         if ($wantu) {
324 324
                             for ($i = 0; $i < $this->m; ++$i) {
325
-                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
326
-                                $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
325
+                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k - 1];
326
+                                $this->U[$i][$k - 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k - 1];
327 327
                                 $this->U[$i][$j] = $t;
328 328
                             }
329 329
                         }
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
                 // Perform one qr step.
333 333
                 case 3:
334 334
                     // Calculate the shift.
335
-                    $scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
336
-                    $sp   = $this->s[$p-1] / $scale;
337
-                    $spm1 = $this->s[$p-2] / $scale;
338
-                    $epm1 = $e[$p-2] / $scale;
335
+                    $scale = max(max(max(max(abs($this->s[$p - 1]), abs($this->s[$p - 2])), abs($e[$p - 2])), abs($this->s[$k])), abs($e[$k]));
336
+                    $sp   = $this->s[$p - 1] / $scale;
337
+                    $spm1 = $this->s[$p - 2] / $scale;
338
+                    $epm1 = $e[$p - 2] / $scale;
339 339
                     $sk   = $this->s[$k] / $scale;
340 340
                     $ek   = $e[$k] / $scale;
341 341
                     $b    = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
@@ -351,41 +351,41 @@  discard block
 block discarded – undo
351 351
                     $f = ($sk + $sp) * ($sk - $sp) + $shift;
352 352
                     $g = $sk * $ek;
353 353
                     // Chase zeros.
354
-                    for ($j = $k; $j < $p-1; ++$j) {
354
+                    for ($j = $k; $j < $p - 1; ++$j) {
355 355
                         $t  = hypo($f, $g);
356
-                        $cs = $f/$t;
357
-                        $sn = $g/$t;
356
+                        $cs = $f / $t;
357
+                        $sn = $g / $t;
358 358
                         if ($j != $k) {
359
-                            $e[$j-1] = $t;
359
+                            $e[$j - 1] = $t;
360 360
                         }
361 361
                         $f = $cs * $this->s[$j] + $sn * $e[$j];
362 362
                         $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
363
-                        $g = $sn * $this->s[$j+1];
364
-                        $this->s[$j+1] = $cs * $this->s[$j+1];
363
+                        $g = $sn * $this->s[$j + 1];
364
+                        $this->s[$j + 1] = $cs * $this->s[$j + 1];
365 365
                         if ($wantv) {
366 366
                             for ($i = 0; $i < $this->n; ++$i) {
367
-                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
368
-                                $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
367
+                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j + 1];
368
+                                $this->V[$i][$j + 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j + 1];
369 369
                                 $this->V[$i][$j] = $t;
370 370
                             }
371 371
                         }
372 372
                         $t = hypo($f, $g);
373
-                        $cs = $f/$t;
374
-                        $sn = $g/$t;
373
+                        $cs = $f / $t;
374
+                        $sn = $g / $t;
375 375
                         $this->s[$j] = $t;
376
-                        $f = $cs * $e[$j] + $sn * $this->s[$j+1];
377
-                        $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
378
-                        $g = $sn * $e[$j+1];
379
-                        $e[$j+1] = $cs * $e[$j+1];
376
+                        $f = $cs * $e[$j] + $sn * $this->s[$j + 1];
377
+                        $this->s[$j + 1] = -$sn * $e[$j] + $cs * $this->s[$j + 1];
378
+                        $g = $sn * $e[$j + 1];
379
+                        $e[$j + 1] = $cs * $e[$j + 1];
380 380
                         if ($wantu && ($j < $this->m - 1)) {
381 381
                             for ($i = 0; $i < $this->m; ++$i) {
382
-                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
383
-                                $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
382
+                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j + 1];
383
+                                $this->U[$i][$j + 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j + 1];
384 384
                                 $this->U[$i][$j] = $t;
385 385
                             }
386 386
                         }
387 387
                     }
388
-                    $e[$p-2] = $f;
388
+                    $e[$p - 2] = $f;
389 389
                     $iter = $iter + 1;
390 390
                     break;
391 391
                 // Convergence.
@@ -401,23 +401,23 @@  discard block
 block discarded – undo
401 401
                     }
402 402
                     // Order the singular values.
403 403
                     while ($k < $pp) {
404
-                        if ($this->s[$k] >= $this->s[$k+1]) {
404
+                        if ($this->s[$k] >= $this->s[$k + 1]) {
405 405
                             break;
406 406
                         }
407 407
                         $t = $this->s[$k];
408
-                        $this->s[$k] = $this->s[$k+1];
409
-                        $this->s[$k+1] = $t;
408
+                        $this->s[$k] = $this->s[$k + 1];
409
+                        $this->s[$k + 1] = $t;
410 410
                         if ($wantv and ($k < $this->n - 1)) {
411 411
                             for ($i = 0; $i < $this->n; ++$i) {
412
-                                $t = $this->V[$i][$k+1];
413
-                                $this->V[$i][$k+1] = $this->V[$i][$k];
412
+                                $t = $this->V[$i][$k + 1];
413
+                                $this->V[$i][$k + 1] = $this->V[$i][$k];
414 414
                                 $this->V[$i][$k] = $t;
415 415
                             }
416 416
                         }
417
-                        if ($wantu and ($k < $this->m-1)) {
417
+                        if ($wantu and ($k < $this->m - 1)) {
418 418
                             for ($i = 0; $i < $this->m; ++$i) {
419
-                                $t = $this->U[$i][$k+1];
420
-                                $this->U[$i][$k+1] = $this->U[$i][$k];
419
+                                $t = $this->U[$i][$k + 1];
420
+                                $this->U[$i][$k + 1] = $this->U[$i][$k];
421 421
                                 $this->U[$i][$k] = $t;
422 422
                             }
423 423
                         }
Please login to merge, or discard this patch.