@@ -109,7 +109,7 @@ |
||
109 | 109 | * Fallback method for writeRaw, introduced in PHP 5.2 |
110 | 110 | * |
111 | 111 | * @param string $text |
112 | - * @return string |
|
112 | + * @return boolean |
|
113 | 113 | */ |
114 | 114 | public function writeRawData($text) |
115 | 115 | { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @var string |
48 | 48 | */ |
49 | - private $tempFileName = ''; |
|
49 | + private $tempFileName = ''; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Create a new XMLWriter instance |
@@ -155,6 +155,9 @@ |
||
155 | 155 | return $contents; |
156 | 156 | } |
157 | 157 | |
158 | + /** |
|
159 | + * @param integer $index |
|
160 | + */ |
|
158 | 161 | public function getFromIndex($index) |
159 | 162 | { |
160 | 163 | $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING); |
@@ -160,7 +160,7 @@ |
||
160 | 160 | $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING); |
161 | 161 | $contents = ''; |
162 | 162 | if ((is_array($extracted)) && ($extracted != 0)) { |
163 | - $contents = $extracted[0]["content"]; |
|
163 | + $contents = $extracted[0]["content"]; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -91,16 +91,16 @@ |
||
91 | 91 | { |
92 | 92 | $filenameParts = pathinfo($localname); |
93 | 93 | |
94 | - $handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb"); |
|
94 | + $handle = fopen($this->tempDir . '/' . $filenameParts["basename"], "wb"); |
|
95 | 95 | fwrite($handle, $contents); |
96 | 96 | fclose($handle); |
97 | 97 | |
98 | - $res = $this->zip->add($this->tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]); |
|
98 | + $res = $this->zip->add($this->tempDir . '/' . $filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]); |
|
99 | 99 | if ($res == 0) { |
100 | 100 | throw new \PHPExcel\Writer\Exception("Error zipping files : " . $this->zip->errorInfo(true)); |
101 | 101 | } |
102 | 102 | |
103 | - unlink($this->tempDir.'/'.$filenameParts["basename"]); |
|
103 | + unlink($this->tempDir . '/' . $filenameParts["basename"]); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * Implements support for fstat(). |
103 | 103 | * |
104 | - * @return boolean |
|
104 | + * @return string |
|
105 | 105 | */ |
106 | 106 | public function statName() |
107 | 107 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * Implements support for fstat(). |
113 | 113 | * |
114 | - * @return boolean |
|
114 | + * @return string |
|
115 | 115 | */ |
116 | 116 | public function url_stat() // @codingStandardsIgnoreLine |
117 | 117 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param int $offset byte offset |
169 | 169 | * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END |
170 | - * @return bool |
|
170 | + * @return boolean|null |
|
171 | 171 | */ |
172 | 172 | public function stream_seek($offset, $whence) // @codingStandardsIgnoreLine |
173 | 173 | { |
@@ -174,26 +174,26 @@ |
||
174 | 174 | switch ($whence) { |
175 | 175 | case SEEK_SET: |
176 | 176 | if ($offset < strlen($this->data) && $offset >= 0) { |
177 | - $this->position = $offset; |
|
178 | - return true; |
|
177 | + $this->position = $offset; |
|
178 | + return true; |
|
179 | 179 | } else { |
180 | - return false; |
|
180 | + return false; |
|
181 | 181 | } |
182 | 182 | break; |
183 | 183 | case SEEK_CUR: |
184 | 184 | if ($offset >= 0) { |
185 | - $this->position += $offset; |
|
186 | - return true; |
|
185 | + $this->position += $offset; |
|
186 | + return true; |
|
187 | 187 | } else { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | break; |
191 | 191 | case SEEK_END: |
192 | 192 | if (strlen($this->data) + $offset >= 0) { |
193 | - $this->position = strlen($this->data) + $offset; |
|
194 | - return true; |
|
193 | + $this->position = strlen($this->data) + $offset; |
|
194 | + return true; |
|
195 | 195 | } else { |
196 | - return false; |
|
196 | + return false; |
|
197 | 197 | } |
198 | 198 | break; |
199 | 199 | default: |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * Get Condition type |
102 | 102 | * |
103 | - * @return string |
|
103 | + * @return integer |
|
104 | 104 | */ |
105 | 105 | public function getConditionType() |
106 | 106 | { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * Get Operator type |
124 | 124 | * |
125 | - * @return string |
|
125 | + * @return integer |
|
126 | 126 | */ |
127 | 127 | public function getOperatorType() |
128 | 128 | { |
@@ -250,8 +250,8 @@ |
||
250 | 250 | */ |
251 | 251 | public function setStyle(\PHPExcel\Style $pValue = null) |
252 | 252 | { |
253 | - $this->style = $pValue; |
|
254 | - return $this; |
|
253 | + $this->style = $pValue; |
|
254 | + return $this; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -467,6 +467,7 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @param string $dynamicRuleType |
469 | 469 | * @param AutoFilter\Column &$filterColumn |
470 | + * @param AutoFilter\Column $filterColumn |
|
470 | 471 | * @return mixed[] |
471 | 472 | */ |
472 | 473 | private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn) |
@@ -571,6 +572,11 @@ discard block |
||
571 | 572 | return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_AND)); |
572 | 573 | } |
573 | 574 | |
575 | + /** |
|
576 | + * @param integer $columnID |
|
577 | + * @param integer $startRow |
|
578 | + * @param string $ruleType |
|
579 | + */ |
|
574 | 580 | private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) |
575 | 581 | { |
576 | 582 | $range = $columnID.$startRow.':'.$columnID.$endRow; |
@@ -711,8 +711,8 @@ |
||
711 | 711 | ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN |
712 | 712 | : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; |
713 | 713 | $ruleValues[] = array('operator' => $operator, |
714 | - 'value' => $average |
|
715 | - ); |
|
714 | + 'value' => $average |
|
715 | + ); |
|
716 | 716 | $columnFilterTests[$columnID] = array( |
717 | 717 | 'method' => 'filterTestInCustomDataSet', |
718 | 718 | 'arguments' => array('filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR) |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | } |
408 | 408 | } else { |
409 | 409 | // String values are always tested for equality, factoring in for wildcards (hence a regexp test) |
410 | - $retVal = preg_match('/^'.$rule['value'].'$/i', $cellValue); |
|
410 | + $retVal = preg_match('/^' . $rule['value'] . '$/i', $cellValue); |
|
411 | 411 | } |
412 | 412 | // If there are multiple conditions, then we need to test both using the appropriate join operator |
413 | 413 | switch ($join) { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @var array |
459 | 459 | */ |
460 | 460 | private static $fromReplace = array('\*', '\?', '~~', '~.*', '~.?'); |
461 | - private static $toReplace = array('.*', '.', '~', '\*', '\?'); |
|
461 | + private static $toReplace = array('.*', '.', '~', '\*', '\?'); |
|
462 | 462 | |
463 | 463 | |
464 | 464 | /** |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER: |
528 | 528 | $thisMonth = date('m', $baseDate); |
529 | 529 | $thisQuarter = floor(--$thisMonth / 3); |
530 | - $maxVal = (int) \PhpSpreadsheet\Shared\Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate))); |
|
530 | + $maxVal = (int) \PhpSpreadsheet\Shared\Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1 + $thisQuarter) * 3, date('Y', $baseDate))); |
|
531 | 531 | ++$maxVal; |
532 | - $val = (int) \PhpSpreadsheet\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate))); |
|
532 | + $val = (int) \PhpSpreadsheet\Shared\Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1 + $thisQuarter * 3, date('Y', $baseDate))); |
|
533 | 533 | break; |
534 | 534 | case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH: |
535 | 535 | case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH: |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) |
574 | 574 | { |
575 | - $range = $columnID.$startRow.':'.$columnID.$endRow; |
|
575 | + $range = $columnID . $startRow . ':' . $columnID . $endRow; |
|
576 | 576 | $dataValues = \PhpSpreadsheet\Calculation\Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false)); |
577 | 577 | |
578 | 578 | $dataValues = array_filter($dataValues); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | ($dynamicRuleType == AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) { |
704 | 704 | // Number (Average) based |
705 | 705 | // Calculate the average |
706 | - $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')'; |
|
706 | + $averageFormula = '=AVERAGE(' . $columnID . ($rangeStart[1] + 1) . ':' . $columnID . $rangeEnd[1] . ')'; |
|
707 | 707 | $average = \PhpSpreadsheet\Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1')); |
708 | 708 | // Set above/below rule based on greaterThan or LessTan |
709 | 709 | $operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) |
@@ -725,8 +725,8 @@ discard block |
||
725 | 725 | $ruleValues = array($period); |
726 | 726 | } else { |
727 | 727 | --$period; |
728 | - $periodEnd = (1+$period)*3; |
|
729 | - $periodStart = 1+$period*3; |
|
728 | + $periodEnd = (1 + $period) * 3; |
|
729 | + $periodStart = 1 + $period * 3; |
|
730 | 730 | $ruleValues = range($periodStart, $periodEnd); |
731 | 731 | } |
732 | 732 | $columnFilterTests[$columnID] = array( |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $ruleValue = 500; |
762 | 762 | } |
763 | 763 | |
764 | - $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue); |
|
764 | + $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1] + 1, $rangeEnd[1], $toptenRuleType, $ruleValue); |
|
765 | 765 | |
766 | 766 | $operator = ($toptenRuleType == AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) |
767 | 767 | ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL |
@@ -780,12 +780,12 @@ discard block |
||
780 | 780 | // var_dump($columnFilterTests); |
781 | 781 | // |
782 | 782 | // Execute the column tests for each row in the autoFilter range to determine show/hide, |
783 | - for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) { |
|
783 | + for ($row = $rangeStart[1] + 1; $row <= $rangeEnd[1]; ++$row) { |
|
784 | 784 | // echo 'Testing Row = ', $row,PHP_EOL; |
785 | 785 | $result = true; |
786 | 786 | foreach ($columnFilterTests as $columnID => $columnFilterTest) { |
787 | 787 | // echo 'Testing cell ', $columnID.$row,PHP_EOL; |
788 | - $cellValue = $this->workSheet->getCell($columnID.$row)->getCalculatedValue(); |
|
788 | + $cellValue = $this->workSheet->getCell($columnID . $row)->getCalculatedValue(); |
|
789 | 789 | // echo 'Value is ', $cellValue,PHP_EOL; |
790 | 790 | // Execute the filter test |
791 | 791 | $result = $result && |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * Get ColumnIndex |
71 | 71 | * |
72 | - * @return string |
|
72 | + * @return integer |
|
73 | 73 | */ |
74 | 74 | public function getColumnIndex() |
75 | 75 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * Set Width |
103 | 103 | * |
104 | - * @param double $pValue |
|
104 | + * @param integer $pValue |
|
105 | 105 | * @return ColumnDimension |
106 | 106 | */ |
107 | 107 | public function setWidth($pValue = -1) |
@@ -60,7 +60,7 @@ |
||
60 | 60 | /** |
61 | 61 | * Create a new Dimension |
62 | 62 | * |
63 | - * @param int $pIndex Numeric row index |
|
63 | + * @param integer $initialValue |
|
64 | 64 | */ |
65 | 65 | public function __construct($initialValue = null) |
66 | 66 | { |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * Set first page number |
803 | 803 | * |
804 | 804 | * @param int $value |
805 | - * @return HeaderFooter |
|
805 | + * @return PageSetup |
|
806 | 806 | */ |
807 | 807 | public function setFirstPageNumber($value = null) |
808 | 808 | { |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | /** |
814 | 814 | * Reset first page number |
815 | 815 | * |
816 | - * @return HeaderFooter |
|
816 | + * @return PageSetup |
|
817 | 817 | */ |
818 | 818 | public function resetFirstPageNumber() |
819 | 819 | { |
@@ -207,27 +207,27 @@ |
||
207 | 207 | private $scale = 100; |
208 | 208 | |
209 | 209 | /** |
210 | - * Fit To Page |
|
211 | - * Whether scale or fitToWith / fitToHeight applies |
|
212 | - * |
|
213 | - * @var boolean |
|
214 | - */ |
|
210 | + * Fit To Page |
|
211 | + * Whether scale or fitToWith / fitToHeight applies |
|
212 | + * |
|
213 | + * @var boolean |
|
214 | + */ |
|
215 | 215 | private $fitToPage = false; |
216 | 216 | |
217 | 217 | /** |
218 | - * Fit To Height |
|
219 | - * Number of vertical pages to fit on |
|
220 | - * |
|
221 | - * @var int? |
|
222 | - */ |
|
218 | + * Fit To Height |
|
219 | + * Number of vertical pages to fit on |
|
220 | + * |
|
221 | + * @var int? |
|
222 | + */ |
|
223 | 223 | private $fitToHeight = 1; |
224 | 224 | |
225 | 225 | /** |
226 | - * Fit To Width |
|
227 | - * Number of horizontal pages to fit on |
|
228 | - * |
|
229 | - * @var int? |
|
230 | - */ |
|
226 | + * Fit To Width |
|
227 | + * Number of horizontal pages to fit on |
|
228 | + * |
|
229 | + * @var int? |
|
230 | + */ |
|
231 | 231 | private $fitToWidth = 1; |
232 | 232 | |
233 | 233 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @var int? |
222 | 222 | */ |
223 | - private $fitToHeight = 1; |
|
223 | + private $fitToHeight = 1; |
|
224 | 224 | |
225 | 225 | /** |
226 | 226 | * Fit To Width |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @var int? |
230 | 230 | */ |
231 | - private $fitToWidth = 1; |
|
231 | + private $fitToWidth = 1; |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Columns to repeat at left |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | return $this->printArea; |
600 | 600 | } |
601 | 601 | $printAreas = explode(',', $this->printArea); |
602 | - if (isset($printAreas[$index-1])) { |
|
603 | - return $printAreas[$index-1]; |
|
602 | + if (isset($printAreas[$index - 1])) { |
|
603 | + return $printAreas[$index - 1]; |
|
604 | 604 | } |
605 | 605 | throw new \PHPExcel\Exception("Requested Print Area does not exist"); |
606 | 606 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | return !is_null($this->printArea); |
621 | 621 | } |
622 | 622 | $printAreas = explode(',', $this->printArea); |
623 | - return isset($printAreas[$index-1]); |
|
623 | + return isset($printAreas[$index - 1]); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | $this->printArea = null; |
639 | 639 | } else { |
640 | 640 | $printAreas = explode(',', $this->printArea); |
641 | - if (isset($printAreas[$index-1])) { |
|
642 | - unset($printAreas[$index-1]); |
|
641 | + if (isset($printAreas[$index - 1])) { |
|
642 | + unset($printAreas[$index - 1]); |
|
643 | 643 | $this->printArea = implode(',', $printAreas); |
644 | 644 | } |
645 | 645 | } |
@@ -689,12 +689,12 @@ discard block |
||
689 | 689 | if (($index <= 0) || ($index > count($printAreas))) { |
690 | 690 | throw new \PHPExcel\Exception('Invalid index for setting print range.'); |
691 | 691 | } |
692 | - $printAreas[$index-1] = $value; |
|
692 | + $printAreas[$index - 1] = $value; |
|
693 | 693 | $this->printArea = implode(',', $printAreas); |
694 | 694 | } |
695 | 695 | } elseif ($method == self::SETPRINTRANGE_INSERT) { |
696 | 696 | if ($index == 0) { |
697 | - $this->printArea .= ($this->printArea == '') ? $value : ','.$value; |
|
697 | + $this->printArea .= ($this->printArea == '') ? $value : ',' . $value; |
|
698 | 698 | } else { |
699 | 699 | $printAreas = explode(',', $this->printArea); |
700 | 700 | if ($index < 0) { |
@@ -101,7 +101,7 @@ |
||
101 | 101 | /** |
102 | 102 | * Set Row Height |
103 | 103 | * |
104 | - * @param double $pValue |
|
104 | + * @param integer $pValue |
|
105 | 105 | * @return RowDimension |
106 | 106 | */ |
107 | 107 | public function setRowHeight($pValue = -1) |
@@ -45,11 +45,11 @@ |
||
45 | 45 | */ |
46 | 46 | private $height = -1; |
47 | 47 | |
48 | - /** |
|
49 | - * ZeroHeight for Row? |
|
50 | - * |
|
51 | - * @var bool |
|
52 | - */ |
|
48 | + /** |
|
49 | + * ZeroHeight for Row? |
|
50 | + * |
|
51 | + * @var bool |
|
52 | + */ |
|
53 | 53 | private $zeroHeight = false; |
54 | 54 | |
55 | 55 | /** |