@@ -33,7 +33,7 @@ |
||
33 | 33 | // $inputFileType = 'Gnumeric'; |
34 | 34 | $inputFileName = './sampleData/example1.xls'; |
35 | 35 | |
36 | -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' information using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
|
36 | +echo 'Loading file ', pathinfo($inputFileName, PATHINFO_BASENAME), ' information using IOFactory with a defined reader type of ', $inputFileType, '<br />'; |
|
37 | 37 | |
38 | 38 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
39 | 39 | $worksheetData = $objReader->listWorksheetInfo($inputFileName); |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | -$exampleTypeList = glob('./*',GLOB_ONLYDIR); |
|
20 | +$exampleTypeList = glob('./*', GLOB_ONLYDIR); |
|
21 | 21 | |
22 | -foreach($exampleTypeList as $exampleType) { |
|
22 | +foreach ($exampleTypeList as $exampleType) { |
|
23 | 23 | |
24 | - echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>'; |
|
24 | + echo '<h1>PHPExcel ' . pathinfo($exampleType, PATHINFO_BASENAME) . ' Examples</h1>'; |
|
25 | 25 | |
26 | - $exampleList = glob('./'.$exampleType.'/*.php'); |
|
26 | + $exampleList = glob('./' . $exampleType . '/*.php'); |
|
27 | 27 | |
28 | - foreach($exampleList as $exampleFile) { |
|
28 | + foreach ($exampleList as $exampleFile) { |
|
29 | 29 | $fileData = file_get_contents($exampleFile); |
30 | 30 | |
31 | 31 | $h1Pattern = '#<h1>(.*?)</h1>#'; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | $h1Text = $out[1]; |
36 | 36 | $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : ''; |
37 | 37 | |
38 | - echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />'; |
|
38 | + echo '<a href="', $exampleFile, '">', $h1Text, '</a><br />'; |
|
39 | 39 | if (($h2Text > '') && |
40 | - (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | - echo $h2Text,'<br />'; |
|
40 | + (pathinfo($exampleType, PATHINFO_BASENAME) != 'Calculations')) { |
|
41 | + echo $h2Text, '<br />'; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | if (is_numeric($field)) { |
56 | 56 | $keys = array_keys($fieldNames); |
57 | - return $keys[$field-1]; |
|
57 | + return $keys[$field - 1]; |
|
58 | 58 | } |
59 | 59 | $key = array_search($field, $fieldNames); |
60 | 60 | return ($key) ? $key : null; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $testConditionCount = 0; |
93 | 93 | foreach ($criteria as $row => $criterion) { |
94 | 94 | if ($criterion[$key] > '') { |
95 | - $testCondition[] = '[:'.$criteriaName.']'.Functions::ifCondition($criterion[$key]); |
|
95 | + $testCondition[] = '[:' . $criteriaName . ']' . Functions::ifCondition($criterion[$key]); |
|
96 | 96 | $testConditionCount++; |
97 | 97 | } |
98 | 98 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | // evaluate the criteria against the row data |
127 | - $result = \PHPExcel\Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList); |
|
127 | + $result = \PHPExcel\Calculation::getInstance()->_calculateFormulaValue('=' . $testConditionList); |
|
128 | 128 | // If the row failed to meet the criteria, remove it from the database |
129 | 129 | if (!$result) { |
130 | 130 | unset($database[$dataRow]); |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | $eom = self::isLastDayOfMonth($result); |
72 | 72 | |
73 | 73 | while ($settlement < \PHPExcel\Shared\Date::PHPToExcel($result)) { |
74 | - $result->modify('-'.$months.' months'); |
|
74 | + $result->modify('-' . $months . ' months'); |
|
75 | 75 | } |
76 | 76 | if ($next) { |
77 | - $result->modify('+'.$months.' months'); |
|
77 | + $result->modify('+' . $months . ' months'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | if ($eom) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | { |
138 | 138 | $pmt = self::PMT($rate, $nper, $pv, $fv, $type); |
139 | 139 | $capital = $pv; |
140 | - for ($i = 1; $i<= $per; ++$i) { |
|
140 | + for ($i = 1; $i <= $per; ++$i) { |
|
141 | 141 | $interest = ($type && $i == 1) ? 0 : -$capital * $rate; |
142 | 142 | $principal = $pmt - $interest; |
143 | 143 | $capital += $principal; |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par = 1000, $frequency = 1, $basis = 0) |
185 | 185 | { |
186 | - $issue = Functions::flattenSingleValue($issue); |
|
187 | - $firstinterest = Functions::flattenSingleValue($firstinterest); |
|
188 | - $settlement = Functions::flattenSingleValue($settlement); |
|
189 | - $rate = Functions::flattenSingleValue($rate); |
|
190 | - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
191 | - $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); |
|
192 | - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
186 | + $issue = Functions::flattenSingleValue($issue); |
|
187 | + $firstinterest = Functions::flattenSingleValue($firstinterest); |
|
188 | + $settlement = Functions::flattenSingleValue($settlement); |
|
189 | + $rate = Functions::flattenSingleValue($rate); |
|
190 | + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
191 | + $frequency = (is_null($frequency)) ? 1 : Functions::flattenSingleValue($frequency); |
|
192 | + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
193 | 193 | |
194 | 194 | // Validate |
195 | 195 | if ((is_numeric($rate)) && (is_numeric($par))) { |
196 | - $rate = (float) $rate; |
|
197 | - $par = (float) $par; |
|
196 | + $rate = (float) $rate; |
|
197 | + $par = (float) $par; |
|
198 | 198 | if (($rate <= 0) || ($par <= 0)) { |
199 | 199 | return Functions::NAN(); |
200 | 200 | } |
@@ -235,16 +235,16 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public static function ACCRINTM($issue, $settlement, $rate, $par = 1000, $basis = 0) |
237 | 237 | { |
238 | - $issue = Functions::flattenSingleValue($issue); |
|
239 | - $settlement = Functions::flattenSingleValue($settlement); |
|
240 | - $rate = Functions::flattenSingleValue($rate); |
|
241 | - $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
242 | - $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
238 | + $issue = Functions::flattenSingleValue($issue); |
|
239 | + $settlement = Functions::flattenSingleValue($settlement); |
|
240 | + $rate = Functions::flattenSingleValue($rate); |
|
241 | + $par = (is_null($par)) ? 1000 : Functions::flattenSingleValue($par); |
|
242 | + $basis = (is_null($basis)) ? 0 : Functions::flattenSingleValue($basis); |
|
243 | 243 | |
244 | 244 | // Validate |
245 | 245 | if ((is_numeric($rate)) && (is_numeric($par))) { |
246 | - $rate = (float) $rate; |
|
247 | - $par = (float) $par; |
|
246 | + $rate = (float) $rate; |
|
247 | + $par = (float) $par; |
|
248 | 248 | if (($rate <= 0) || ($par <= 0)) { |
249 | 249 | return Functions::NAN(); |
250 | 250 | } |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0) |
294 | 294 | { |
295 | - $cost = Functions::flattenSingleValue($cost); |
|
296 | - $purchased = Functions::flattenSingleValue($purchased); |
|
295 | + $cost = Functions::flattenSingleValue($cost); |
|
296 | + $purchased = Functions::flattenSingleValue($purchased); |
|
297 | 297 | $firstPeriod = Functions::flattenSingleValue($firstPeriod); |
298 | 298 | $salvage = Functions::flattenSingleValue($salvage); |
299 | - $period = floor(Functions::flattenSingleValue($period)); |
|
300 | - $rate = Functions::flattenSingleValue($rate); |
|
301 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
299 | + $period = floor(Functions::flattenSingleValue($period)); |
|
300 | + $rate = Functions::flattenSingleValue($rate); |
|
301 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
302 | 302 | |
303 | 303 | // The depreciation coefficients are: |
304 | 304 | // Life of assets (1/rate) Depreciation coefficient |
@@ -628,10 +628,10 @@ discard block |
||
628 | 628 | */ |
629 | 629 | public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0) |
630 | 630 | { |
631 | - $settlement = Functions::flattenSingleValue($settlement); |
|
632 | - $maturity = Functions::flattenSingleValue($maturity); |
|
631 | + $settlement = Functions::flattenSingleValue($settlement); |
|
632 | + $maturity = Functions::flattenSingleValue($maturity); |
|
633 | 633 | $frequency = (int) Functions::flattenSingleValue($frequency); |
634 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
634 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
635 | 635 | |
636 | 636 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
637 | 637 | return Functions::VALUE(); |
@@ -685,10 +685,10 @@ discard block |
||
685 | 685 | */ |
686 | 686 | public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0) |
687 | 687 | { |
688 | - $settlement = Functions::flattenSingleValue($settlement); |
|
689 | - $maturity = Functions::flattenSingleValue($maturity); |
|
688 | + $settlement = Functions::flattenSingleValue($settlement); |
|
689 | + $maturity = Functions::flattenSingleValue($maturity); |
|
690 | 690 | $frequency = (int) Functions::flattenSingleValue($frequency); |
691 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
691 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
692 | 692 | |
693 | 693 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
694 | 694 | return Functions::VALUE(); |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0) |
759 | 759 | { |
760 | - $settlement = Functions::flattenSingleValue($settlement); |
|
761 | - $maturity = Functions::flattenSingleValue($maturity); |
|
760 | + $settlement = Functions::flattenSingleValue($settlement); |
|
761 | + $maturity = Functions::flattenSingleValue($maturity); |
|
762 | 762 | $frequency = (int) Functions::flattenSingleValue($frequency); |
763 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
763 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
764 | 764 | |
765 | 765 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
766 | 766 | return Functions::VALUE(); |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | { |
805 | 805 | $rate = Functions::flattenSingleValue($rate); |
806 | 806 | $nper = (int) Functions::flattenSingleValue($nper); |
807 | - $pv = Functions::flattenSingleValue($pv); |
|
808 | - $start = (int) Functions::flattenSingleValue($start); |
|
809 | - $end = (int) Functions::flattenSingleValue($end); |
|
810 | - $type = (int) Functions::flattenSingleValue($type); |
|
807 | + $pv = Functions::flattenSingleValue($pv); |
|
808 | + $start = (int) Functions::flattenSingleValue($start); |
|
809 | + $end = (int) Functions::flattenSingleValue($end); |
|
810 | + $type = (int) Functions::flattenSingleValue($type); |
|
811 | 811 | |
812 | 812 | // Validate parameters |
813 | 813 | if ($type != 0 && $type != 1) { |
@@ -852,10 +852,10 @@ discard block |
||
852 | 852 | { |
853 | 853 | $rate = Functions::flattenSingleValue($rate); |
854 | 854 | $nper = (int) Functions::flattenSingleValue($nper); |
855 | - $pv = Functions::flattenSingleValue($pv); |
|
856 | - $start = (int) Functions::flattenSingleValue($start); |
|
857 | - $end = (int) Functions::flattenSingleValue($end); |
|
858 | - $type = (int) Functions::flattenSingleValue($type); |
|
855 | + $pv = Functions::flattenSingleValue($pv); |
|
856 | + $start = (int) Functions::flattenSingleValue($start); |
|
857 | + $end = (int) Functions::flattenSingleValue($end); |
|
858 | + $type = (int) Functions::flattenSingleValue($type); |
|
859 | 859 | |
860 | 860 | // Validate parameters |
861 | 861 | if ($type != 0 && $type != 1) { |
@@ -904,10 +904,10 @@ discard block |
||
904 | 904 | public static function DB($cost, $salvage, $life, $period, $month = 12) |
905 | 905 | { |
906 | 906 | $cost = Functions::flattenSingleValue($cost); |
907 | - $salvage = Functions::flattenSingleValue($salvage); |
|
907 | + $salvage = Functions::flattenSingleValue($salvage); |
|
908 | 908 | $life = Functions::flattenSingleValue($life); |
909 | - $period = Functions::flattenSingleValue($period); |
|
910 | - $month = Functions::flattenSingleValue($month); |
|
909 | + $period = Functions::flattenSingleValue($period); |
|
910 | + $month = Functions::flattenSingleValue($month); |
|
911 | 911 | |
912 | 912 | // Validate |
913 | 913 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) { |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | public static function DDB($cost, $salvage, $life, $period, $factor = 2.0) |
973 | 973 | { |
974 | 974 | $cost = Functions::flattenSingleValue($cost); |
975 | - $salvage = Functions::flattenSingleValue($salvage); |
|
975 | + $salvage = Functions::flattenSingleValue($salvage); |
|
976 | 976 | $life = Functions::flattenSingleValue($life); |
977 | 977 | $period = Functions::flattenSingleValue($period); |
978 | 978 | $factor = Functions::flattenSingleValue($factor); |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0) |
1035 | 1035 | { |
1036 | 1036 | $settlement = Functions::flattenSingleValue($settlement); |
1037 | - $maturity = Functions::flattenSingleValue($maturity); |
|
1037 | + $maturity = Functions::flattenSingleValue($maturity); |
|
1038 | 1038 | $price = Functions::flattenSingleValue($price); |
1039 | 1039 | $redemption = Functions::flattenSingleValue($redemption); |
1040 | 1040 | $basis = Functions::flattenSingleValue($basis); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | // Validate |
1043 | 1043 | if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
1044 | 1044 | $price = (float) $price; |
1045 | - $redemption = (float) $redemption; |
|
1045 | + $redemption = (float) $redemption; |
|
1046 | 1046 | $basis = (int) $basis; |
1047 | 1047 | if (($price <= 0) || ($redemption <= 0)) { |
1048 | 1048 | return Functions::NAN(); |
@@ -1077,8 +1077,8 @@ discard block |
||
1077 | 1077 | */ |
1078 | 1078 | public static function DOLLARDE($fractional_dollar = null, $fraction = 0) |
1079 | 1079 | { |
1080 | - $fractional_dollar = Functions::flattenSingleValue($fractional_dollar); |
|
1081 | - $fraction = (int)Functions::flattenSingleValue($fraction); |
|
1080 | + $fractional_dollar = Functions::flattenSingleValue($fractional_dollar); |
|
1081 | + $fraction = (int) Functions::flattenSingleValue($fraction); |
|
1082 | 1082 | |
1083 | 1083 | // Validate parameters |
1084 | 1084 | if (is_null($fractional_dollar) || $fraction < 0) { |
@@ -1114,8 +1114,8 @@ discard block |
||
1114 | 1114 | */ |
1115 | 1115 | public static function DOLLARFR($decimal_dollar = null, $fraction = 0) |
1116 | 1116 | { |
1117 | - $decimal_dollar = Functions::flattenSingleValue($decimal_dollar); |
|
1118 | - $fraction = (int)Functions::flattenSingleValue($fraction); |
|
1117 | + $decimal_dollar = Functions::flattenSingleValue($decimal_dollar); |
|
1118 | + $fraction = (int) Functions::flattenSingleValue($fraction); |
|
1119 | 1119 | |
1120 | 1120 | // Validate parameters |
1121 | 1121 | if (is_null($decimal_dollar) || $fraction < 0) { |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | */ |
1151 | 1151 | public static function EFFECT($nominal_rate = 0, $npery = 0) |
1152 | 1152 | { |
1153 | - $nominal_rate = Functions::flattenSingleValue($nominal_rate); |
|
1154 | - $npery = (int)Functions::flattenSingleValue($npery); |
|
1153 | + $nominal_rate = Functions::flattenSingleValue($nominal_rate); |
|
1154 | + $npery = (int) Functions::flattenSingleValue($npery); |
|
1155 | 1155 | |
1156 | 1156 | // Validate parameters |
1157 | 1157 | if ($nominal_rate <= 0 || $npery < 1) { |
@@ -1188,8 +1188,8 @@ discard block |
||
1188 | 1188 | { |
1189 | 1189 | $rate = Functions::flattenSingleValue($rate); |
1190 | 1190 | $nper = Functions::flattenSingleValue($nper); |
1191 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1192 | - $pv = Functions::flattenSingleValue($pv); |
|
1191 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1192 | + $pv = Functions::flattenSingleValue($pv); |
|
1193 | 1193 | $type = Functions::flattenSingleValue($type); |
1194 | 1194 | |
1195 | 1195 | // Validate parameters |
@@ -1220,8 +1220,8 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | public static function FVSCHEDULE($principal, $schedule) |
1222 | 1222 | { |
1223 | - $principal = Functions::flattenSingleValue($principal); |
|
1224 | - $schedule = Functions::flattenArray($schedule); |
|
1223 | + $principal = Functions::flattenSingleValue($principal); |
|
1224 | + $schedule = Functions::flattenArray($schedule); |
|
1225 | 1225 | |
1226 | 1226 | foreach ($schedule as $rate) { |
1227 | 1227 | $principal *= 1 + $rate; |
@@ -1256,16 +1256,16 @@ discard block |
||
1256 | 1256 | public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0) |
1257 | 1257 | { |
1258 | 1258 | $settlement = Functions::flattenSingleValue($settlement); |
1259 | - $maturity = Functions::flattenSingleValue($maturity); |
|
1259 | + $maturity = Functions::flattenSingleValue($maturity); |
|
1260 | 1260 | $investment = Functions::flattenSingleValue($investment); |
1261 | 1261 | $redemption = Functions::flattenSingleValue($redemption); |
1262 | - $basis = Functions::flattenSingleValue($basis); |
|
1262 | + $basis = Functions::flattenSingleValue($basis); |
|
1263 | 1263 | |
1264 | 1264 | // Validate |
1265 | 1265 | if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
1266 | 1266 | $investment = (float) $investment; |
1267 | 1267 | $redemption = (float) $redemption; |
1268 | - $basis = (int) $basis; |
|
1268 | + $basis = (int) $basis; |
|
1269 | 1269 | if (($investment <= 0) || ($redemption <= 0)) { |
1270 | 1270 | return Functions::NAN(); |
1271 | 1271 | } |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) |
1301 | 1301 | { |
1302 | 1302 | $rate = Functions::flattenSingleValue($rate); |
1303 | - $per = (int) Functions::flattenSingleValue($per); |
|
1303 | + $per = (int) Functions::flattenSingleValue($per); |
|
1304 | 1304 | $nper = (int) Functions::flattenSingleValue($nper); |
1305 | 1305 | $pv = Functions::flattenSingleValue($pv); |
1306 | 1306 | $fv = Functions::flattenSingleValue($fv); |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | |
1420 | 1420 | // Calculate |
1421 | 1421 | $principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0); |
1422 | - for ($i=0; $i <= $period; ++$i) { |
|
1422 | + for ($i = 0; $i <= $period; ++$i) { |
|
1423 | 1423 | $returnValue = $interestRate * $principleRemaining * -1; |
1424 | 1424 | $principleRemaining -= $principlePayment; |
1425 | 1425 | // principle needs to be 0 after the last payment, don't let floating point screw it up |
@@ -1452,9 +1452,9 @@ discard block |
||
1452 | 1452 | if (!is_array($values)) { |
1453 | 1453 | return Functions::VALUE(); |
1454 | 1454 | } |
1455 | - $values = Functions::flattenArray($values); |
|
1456 | - $finance_rate = Functions::flattenSingleValue($finance_rate); |
|
1457 | - $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate); |
|
1455 | + $values = Functions::flattenArray($values); |
|
1456 | + $finance_rate = Functions::flattenSingleValue($finance_rate); |
|
1457 | + $reinvestment_rate = Functions::flattenSingleValue($reinvestment_rate); |
|
1458 | 1458 | $n = count($values); |
1459 | 1459 | |
1460 | 1460 | $rr = 1.0 + $reinvestment_rate; |
@@ -1491,8 +1491,8 @@ discard block |
||
1491 | 1491 | */ |
1492 | 1492 | public static function NOMINAL($effect_rate = 0, $npery = 0) |
1493 | 1493 | { |
1494 | - $effect_rate = Functions::flattenSingleValue($effect_rate); |
|
1495 | - $npery = (int)Functions::flattenSingleValue($npery); |
|
1494 | + $effect_rate = Functions::flattenSingleValue($effect_rate); |
|
1495 | + $npery = (int) Functions::flattenSingleValue($npery); |
|
1496 | 1496 | |
1497 | 1497 | // Validate parameters |
1498 | 1498 | if ($effect_rate <= 0 || $npery < 1) { |
@@ -1518,11 +1518,11 @@ discard block |
||
1518 | 1518 | */ |
1519 | 1519 | public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0) |
1520 | 1520 | { |
1521 | - $rate = Functions::flattenSingleValue($rate); |
|
1522 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1521 | + $rate = Functions::flattenSingleValue($rate); |
|
1522 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1523 | 1523 | $pv = Functions::flattenSingleValue($pv); |
1524 | 1524 | $fv = Functions::flattenSingleValue($fv); |
1525 | - $type = Functions::flattenSingleValue($type); |
|
1525 | + $type = Functions::flattenSingleValue($type); |
|
1526 | 1526 | |
1527 | 1527 | // Validate parameters |
1528 | 1528 | if ($type != 0 && $type != 1) { |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | if ($pmt == 0) { |
1540 | 1540 | return Functions::NAN(); |
1541 | 1541 | } |
1542 | - return (-$pv -$fv) / $pmt; |
|
1542 | + return (-$pv - $fv) / $pmt; |
|
1543 | 1543 | } |
1544 | 1544 | |
1545 | 1545 | /** |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0) |
1620 | 1620 | { |
1621 | 1621 | $rate = Functions::flattenSingleValue($rate); |
1622 | - $per = (int) Functions::flattenSingleValue($per); |
|
1622 | + $per = (int) Functions::flattenSingleValue($per); |
|
1623 | 1623 | $nper = (int) Functions::flattenSingleValue($nper); |
1624 | 1624 | $pv = Functions::flattenSingleValue($pv); |
1625 | 1625 | $fv = Functions::flattenSingleValue($fv); |
@@ -1641,13 +1641,13 @@ discard block |
||
1641 | 1641 | |
1642 | 1642 | public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0) |
1643 | 1643 | { |
1644 | - $settlement = Functions::flattenSingleValue($settlement); |
|
1644 | + $settlement = Functions::flattenSingleValue($settlement); |
|
1645 | 1645 | $maturity = Functions::flattenSingleValue($maturity); |
1646 | 1646 | $rate = (float) Functions::flattenSingleValue($rate); |
1647 | 1647 | $yield = (float) Functions::flattenSingleValue($yield); |
1648 | - $redemption = (float) Functions::flattenSingleValue($redemption); |
|
1648 | + $redemption = (float) Functions::flattenSingleValue($redemption); |
|
1649 | 1649 | $frequency = (int) Functions::flattenSingleValue($frequency); |
1650 | - $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
1650 | + $basis = (is_null($basis)) ? 0 : (int) Functions::flattenSingleValue($basis); |
|
1651 | 1651 | |
1652 | 1652 | if (is_string($settlement = DateTime::getDateValue($settlement))) { |
1653 | 1653 | return Functions::VALUE(); |
@@ -1667,9 +1667,9 @@ discard block |
||
1667 | 1667 | $n = self::COUPNUM($settlement, $maturity, $frequency, $basis); |
1668 | 1668 | $a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis); |
1669 | 1669 | |
1670 | - $baseYF = 1.0 + ($yield / $frequency); |
|
1670 | + $baseYF = 1.0 + ($yield / $frequency); |
|
1671 | 1671 | $rfp = 100 * ($rate / $frequency); |
1672 | - $de = $dsc / $e; |
|
1672 | + $de = $dsc / $e; |
|
1673 | 1673 | |
1674 | 1674 | $result = $redemption / pow($baseYF, (--$n + $de)); |
1675 | 1675 | for ($k = 0; $k <= $n; ++$k) { |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | $maturity = Functions::flattenSingleValue($maturity); |
1707 | 1707 | $discount = (float) Functions::flattenSingleValue($discount); |
1708 | 1708 | $redemption = (float) Functions::flattenSingleValue($redemption); |
1709 | - $basis = (int) Functions::flattenSingleValue($basis); |
|
1709 | + $basis = (int) Functions::flattenSingleValue($basis); |
|
1710 | 1710 | |
1711 | 1711 | // Validate |
1712 | 1712 | if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) { |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | */ |
1748 | 1748 | public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0) |
1749 | 1749 | { |
1750 | - $settlement = Functions::flattenSingleValue($settlement); |
|
1750 | + $settlement = Functions::flattenSingleValue($settlement); |
|
1751 | 1751 | $maturity = Functions::flattenSingleValue($maturity); |
1752 | 1752 | $issue = Functions::flattenSingleValue($issue); |
1753 | 1753 | $rate = Functions::flattenSingleValue($rate); |
@@ -1806,8 +1806,8 @@ discard block |
||
1806 | 1806 | { |
1807 | 1807 | $rate = Functions::flattenSingleValue($rate); |
1808 | 1808 | $nper = Functions::flattenSingleValue($nper); |
1809 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1810 | - $fv = Functions::flattenSingleValue($fv); |
|
1809 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1810 | + $fv = Functions::flattenSingleValue($fv); |
|
1811 | 1811 | $type = Functions::flattenSingleValue($type); |
1812 | 1812 | |
1813 | 1813 | // Validate parameters |
@@ -1855,12 +1855,12 @@ discard block |
||
1855 | 1855 | **/ |
1856 | 1856 | public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1) |
1857 | 1857 | { |
1858 | - $nper = (int) Functions::flattenSingleValue($nper); |
|
1859 | - $pmt = Functions::flattenSingleValue($pmt); |
|
1858 | + $nper = (int) Functions::flattenSingleValue($nper); |
|
1859 | + $pmt = Functions::flattenSingleValue($pmt); |
|
1860 | 1860 | $pv = Functions::flattenSingleValue($pv); |
1861 | - $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); |
|
1862 | - $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); |
|
1863 | - $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); |
|
1861 | + $fv = (is_null($fv)) ? 0.0 : Functions::flattenSingleValue($fv); |
|
1862 | + $type = (is_null($type)) ? 0 : (int) Functions::flattenSingleValue($type); |
|
1863 | + $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); |
|
1864 | 1864 | |
1865 | 1865 | $rate = $guess; |
1866 | 1866 | if (abs($rate) < FINANCIAL_PRECISION) { |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | $maturity = Functions::flattenSingleValue($maturity); |
1923 | 1923 | $investment = (float) Functions::flattenSingleValue($investment); |
1924 | 1924 | $discount = (float) Functions::flattenSingleValue($discount); |
1925 | - $basis = (int) Functions::flattenSingleValue($basis); |
|
1925 | + $basis = (int) Functions::flattenSingleValue($basis); |
|
1926 | 1926 | |
1927 | 1927 | // Validate |
1928 | 1928 | if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) { |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | return $daysBetweenSettlementAndMaturity; |
1936 | 1936 | } |
1937 | 1937 | |
1938 | - return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity)); |
|
1938 | + return $investment / (1 - ($discount * $daysBetweenSettlementAndMaturity)); |
|
1939 | 1939 | } |
1940 | 1940 | return Functions::VALUE(); |
1941 | 1941 | } |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | public static function SLN($cost, $salvage, $life) |
1955 | 1955 | { |
1956 | 1956 | $cost = Functions::flattenSingleValue($cost); |
1957 | - $salvage = Functions::flattenSingleValue($salvage); |
|
1957 | + $salvage = Functions::flattenSingleValue($salvage); |
|
1958 | 1958 | $life = Functions::flattenSingleValue($life); |
1959 | 1959 | |
1960 | 1960 | // Calculate |
@@ -1982,9 +1982,9 @@ discard block |
||
1982 | 1982 | public static function SYD($cost, $salvage, $life, $period) |
1983 | 1983 | { |
1984 | 1984 | $cost = Functions::flattenSingleValue($cost); |
1985 | - $salvage = Functions::flattenSingleValue($salvage); |
|
1985 | + $salvage = Functions::flattenSingleValue($salvage); |
|
1986 | 1986 | $life = Functions::flattenSingleValue($life); |
1987 | - $period = Functions::flattenSingleValue($period); |
|
1987 | + $period = Functions::flattenSingleValue($period); |
|
1988 | 1988 | |
1989 | 1989 | // Calculate |
1990 | 1990 | if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) { |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | */ |
2012 | 2012 | public static function TBILLEQ($settlement, $maturity, $discount) |
2013 | 2013 | { |
2014 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2014 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2015 | 2015 | $maturity = Functions::flattenSingleValue($maturity); |
2016 | 2016 | $discount = Functions::flattenSingleValue($discount); |
2017 | 2017 | |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | */ |
2051 | 2051 | public static function TBILLPRICE($settlement, $maturity, $discount) |
2052 | 2052 | { |
2053 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2053 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2054 | 2054 | $maturity = Functions::flattenSingleValue($maturity); |
2055 | 2055 | $discount = Functions::flattenSingleValue($discount); |
2056 | 2056 | |
@@ -2103,9 +2103,9 @@ discard block |
||
2103 | 2103 | */ |
2104 | 2104 | public static function TBILLYIELD($settlement, $maturity, $price) |
2105 | 2105 | { |
2106 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2107 | - $maturity = Functions::flattenSingleValue($maturity); |
|
2108 | - $price = Functions::flattenSingleValue($price); |
|
2106 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2107 | + $maturity = Functions::flattenSingleValue($maturity); |
|
2108 | + $price = Functions::flattenSingleValue($price); |
|
2109 | 2109 | |
2110 | 2110 | // Validate |
2111 | 2111 | if (is_numeric($price)) { |
@@ -2216,7 +2216,7 @@ discard block |
||
2216 | 2216 | if ((!is_array($values)) || (!is_array($dates))) { |
2217 | 2217 | return Functions::VALUE(); |
2218 | 2218 | } |
2219 | - $values = Functions::flattenArray($values); |
|
2219 | + $values = Functions::flattenArray($values); |
|
2220 | 2220 | $dates = Functions::flattenArray($dates); |
2221 | 2221 | $valCount = count($values); |
2222 | 2222 | if ($valCount != count($dates)) { |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0) |
2260 | 2260 | { |
2261 | 2261 | $settlement = Functions::flattenSingleValue($settlement); |
2262 | - $maturity = Functions::flattenSingleValue($maturity); |
|
2262 | + $maturity = Functions::flattenSingleValue($maturity); |
|
2263 | 2263 | $price = Functions::flattenSingleValue($price); |
2264 | 2264 | $redemption = Functions::flattenSingleValue($redemption); |
2265 | 2265 | $basis = (int) Functions::flattenSingleValue($basis); |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | */ |
2309 | 2309 | public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0) |
2310 | 2310 | { |
2311 | - $settlement = Functions::flattenSingleValue($settlement); |
|
2311 | + $settlement = Functions::flattenSingleValue($settlement); |
|
2312 | 2312 | $maturity = Functions::flattenSingleValue($maturity); |
2313 | 2313 | $issue = Functions::flattenSingleValue($issue); |
2314 | 2314 | $rate = Functions::flattenSingleValue($rate); |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | $frac = $h; |
168 | 168 | $m = 1; |
169 | 169 | $delta = 0.0; |
170 | - while ($m <= MAX_ITERATIONS && abs($delta-1.0) > PRECISION) { |
|
170 | + while ($m <= MAX_ITERATIONS && abs($delta - 1.0) > PRECISION) { |
|
171 | 171 | $m2 = 2 * $m; |
172 | 172 | // even index for d |
173 | - $d = $m * ($q - $m) * $x / ( ($p_minus + $m2) * ($p + $m2)); |
|
173 | + $d = $m * ($q - $m) * $x / (($p_minus + $m2) * ($p + $m2)); |
|
174 | 174 | $h = 1.0 + $d * $h; |
175 | 175 | if (abs($h) < XMININ) { |
176 | 176 | $h = XMININ; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | 341747634550.7377132798597, |
315 | 315 | 446315818741.9713286462081 |
316 | 316 | ); |
317 | - static $lg_c = array( |
|
317 | + static $lg_c = array( |
|
318 | 318 | -0.001910444077728, |
319 | 319 | 8.4171387781295e-4, |
320 | 320 | -5.952379913043012e-4, |
@@ -428,14 +428,14 @@ discard block |
||
428 | 428 | { |
429 | 429 | static $max = 32; |
430 | 430 | $summer = 0; |
431 | - for ($n=0; $n<=$max; ++$n) { |
|
431 | + for ($n = 0; $n <= $max; ++$n) { |
|
432 | 432 | $divisor = $a; |
433 | - for ($i=1; $i<=$n; ++$i) { |
|
433 | + for ($i = 1; $i <= $n; ++$i) { |
|
434 | 434 | $divisor *= ($a + $i); |
435 | 435 | } |
436 | 436 | $summer += (pow($x, $n) / $divisor); |
437 | 437 | } |
438 | - return pow($x, $a) * exp(0-$x) * $summer; |
|
438 | + return pow($x, $a) * exp(0 - $x) * $summer; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $tmp -= ($x + 0.5) * log($tmp); |
464 | 464 | |
465 | 465 | $summer = $p0; |
466 | - for ($j=1; $j<=6; ++$j) { |
|
466 | + for ($j = 1; $j <= 6; ++$j) { |
|
467 | 467 | $summer += ($p[$j] / ++$y); |
468 | 468 | } |
469 | 469 | return exp(0 - $tmp + log(SQRT2PI * $summer / $x)); |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | ); |
528 | 528 | |
529 | 529 | // Define lower and upper region break-points. |
530 | - $p_low = 0.02425; //Use lower region approx. below this |
|
531 | - $p_high = 1 - $p_low; //Use upper region approx. above this |
|
530 | + $p_low = 0.02425; //Use lower region approx. below this |
|
531 | + $p_high = 1 - $p_low; //Use upper region approx. above this |
|
532 | 532 | |
533 | 533 | if (0 < $p && $p < $p_low) { |
534 | 534 | // Rational approximation for lower region. |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | if (!is_numeric($arg)) { |
869 | 869 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
870 | 870 | } |
871 | - $testCondition = '='.$arg.$condition; |
|
871 | + $testCondition = '=' . $arg . $condition; |
|
872 | 872 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
873 | 873 | if ((is_null($returnValue)) || ($arg > $returnValue)) { |
874 | 874 | $returnValue += $arg; |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | } |
1016 | 1016 | return $summer; |
1017 | 1017 | } else { |
1018 | - return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value) ; |
|
1018 | + return MathTrig::COMBIN($trials, $value) * pow($probability, $value) * pow(1 - $probability, $trials - $value); |
|
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | } |
1048 | 1048 | return Functions::NAN(); |
1049 | 1049 | } |
1050 | - return 1 - (self::incompleteGamma($degrees/2, $value/2) / self::gamma($degrees/2)); |
|
1050 | + return 1 - (self::incompleteGamma($degrees / 2, $value / 2) / self::gamma($degrees / 2)); |
|
1051 | 1051 | } |
1052 | 1052 | return Functions::VALUE(); |
1053 | 1053 | } |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $xHi = 0; |
1073 | 1073 | |
1074 | 1074 | $x = $xNew = 1; |
1075 | - $dx = 1; |
|
1075 | + $dx = 1; |
|
1076 | 1076 | $i = 0; |
1077 | 1077 | |
1078 | 1078 | while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | if (!is_numeric($arg)) { |
1290 | 1290 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
1291 | 1291 | } |
1292 | - $testCondition = '='.$arg.$condition; |
|
1292 | + $testCondition = '=' . $arg . $condition; |
|
1293 | 1293 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
1294 | 1294 | // Is it a value within our criteria |
1295 | 1295 | ++$returnValue; |
@@ -1517,9 +1517,9 @@ discard block |
||
1517 | 1517 | */ |
1518 | 1518 | public static function EXPONDIST($value, $lambda, $cumulative) |
1519 | 1519 | { |
1520 | - $value = Functions::flattenSingleValue($value); |
|
1521 | - $lambda = Functions::flattenSingleValue($lambda); |
|
1522 | - $cumulative = Functions::flattenSingleValue($cumulative); |
|
1520 | + $value = Functions::flattenSingleValue($value); |
|
1521 | + $lambda = Functions::flattenSingleValue($lambda); |
|
1522 | + $cumulative = Functions::flattenSingleValue($cumulative); |
|
1523 | 1523 | |
1524 | 1524 | if ((is_numeric($value)) && (is_numeric($lambda))) { |
1525 | 1525 | if (($value < 0) || ($lambda < 0)) { |
@@ -1527,9 +1527,9 @@ discard block |
||
1527 | 1527 | } |
1528 | 1528 | if ((is_numeric($cumulative)) || (is_bool($cumulative))) { |
1529 | 1529 | if ($cumulative) { |
1530 | - return 1 - exp(0-$value*$lambda); |
|
1530 | + return 1 - exp(0 - $value * $lambda); |
|
1531 | 1531 | } else { |
1532 | - return $lambda * exp(0-$value*$lambda); |
|
1532 | + return $lambda * exp(0 - $value * $lambda); |
|
1533 | 1533 | } |
1534 | 1534 | } |
1535 | 1535 | } |
@@ -1549,13 +1549,13 @@ discard block |
||
1549 | 1549 | */ |
1550 | 1550 | public static function FISHER($value) |
1551 | 1551 | { |
1552 | - $value = Functions::flattenSingleValue($value); |
|
1552 | + $value = Functions::flattenSingleValue($value); |
|
1553 | 1553 | |
1554 | 1554 | if (is_numeric($value)) { |
1555 | 1555 | if (($value <= -1) || ($value >= 1)) { |
1556 | 1556 | return Functions::NAN(); |
1557 | 1557 | } |
1558 | - return 0.5 * log((1+$value)/(1-$value)); |
|
1558 | + return 0.5 * log((1 + $value) / (1 - $value)); |
|
1559 | 1559 | } |
1560 | 1560 | return Functions::VALUE(); |
1561 | 1561 | } |
@@ -1573,7 +1573,7 @@ discard block |
||
1573 | 1573 | */ |
1574 | 1574 | public static function FISHERINV($value) |
1575 | 1575 | { |
1576 | - $value = Functions::flattenSingleValue($value); |
|
1576 | + $value = Functions::flattenSingleValue($value); |
|
1577 | 1577 | |
1578 | 1578 | if (is_numeric($value)) { |
1579 | 1579 | return (exp(2 * $value) - 1) / (exp(2 * $value) + 1); |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | */ |
1595 | 1595 | public static function FORECAST($xValue, $yValues, $xValues) |
1596 | 1596 | { |
1597 | - $xValue = Functions::flattenSingleValue($xValue); |
|
1597 | + $xValue = Functions::flattenSingleValue($xValue); |
|
1598 | 1598 | if (!is_numeric($xValue)) { |
1599 | 1599 | return Functions::VALUE(); |
1600 | 1600 | } elseif (!self::checkTrendArrays($yValues, $xValues)) { |
@@ -1640,7 +1640,7 @@ discard block |
||
1640 | 1640 | if ($cumulative) { |
1641 | 1641 | return self::incompleteGamma($a, $value / $b) / self::gamma($a); |
1642 | 1642 | } else { |
1643 | - return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a-1) * exp(0-($value / $b)); |
|
1643 | + return (1 / (pow($b, $a) * self::gamma($a))) * pow($value, $a - 1) * exp(0 - ($value / $b)); |
|
1644 | 1644 | } |
1645 | 1645 | } |
1646 | 1646 | } |
@@ -1720,7 +1720,7 @@ discard block |
||
1720 | 1720 | */ |
1721 | 1721 | public static function GAMMALN($value) |
1722 | 1722 | { |
1723 | - $value = Functions::flattenSingleValue($value); |
|
1723 | + $value = Functions::flattenSingleValue($value); |
|
1724 | 1724 | |
1725 | 1725 | if (is_numeric($value)) { |
1726 | 1726 | if ($value <= 0) { |
@@ -1753,7 +1753,7 @@ discard block |
||
1753 | 1753 | |
1754 | 1754 | $aMean = MathTrig::PRODUCT($aArgs); |
1755 | 1755 | if (is_numeric($aMean) && ($aMean > 0)) { |
1756 | - $aCount = self::COUNT($aArgs) ; |
|
1756 | + $aCount = self::COUNT($aArgs); |
|
1757 | 1757 | if (self::MIN($aArgs) > 0) { |
1758 | 1758 | return pow($aMean, (1 / $aCount)); |
1759 | 1759 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | |
1944 | 1944 | // Return |
1945 | 1945 | if ($count > 3) { |
1946 | - return $summer * ($count * ($count+1) / (($count-1) * ($count-2) * ($count-3))) - (3 * pow($count-1, 2) / (($count-2) * ($count-3))); |
|
1946 | + return $summer * ($count * ($count + 1) / (($count - 1) * ($count - 2) * ($count - 3))) - (3 * pow($count - 1, 2) / (($count - 2) * ($count - 3))); |
|
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | return Functions::DIV0(); |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | if (!is_numeric($arg)) { |
2282 | 2282 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
2283 | 2283 | } |
2284 | - $testCondition = '='.$arg.$condition; |
|
2284 | + $testCondition = '=' . $arg . $condition; |
|
2285 | 2285 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
2286 | 2286 | if ((is_null($returnValue)) || ($arg > $returnValue)) { |
2287 | 2287 | $returnValue = $arg; |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | if (!is_numeric($arg)) { |
2441 | 2441 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
2442 | 2442 | } |
2443 | - $testCondition = '='.$arg.$condition; |
|
2443 | + $testCondition = '=' . $arg . $condition; |
|
2444 | 2444 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
2445 | 2445 | if ((is_null($returnValue)) || ($arg < $returnValue)) { |
2446 | 2446 | $returnValue = $arg; |
@@ -2697,14 +2697,14 @@ discard block |
||
2697 | 2697 | if ($mValueCount > 0) { |
2698 | 2698 | sort($mArgs); |
2699 | 2699 | $count = self::COUNT($mArgs); |
2700 | - $index = $entry * ($count-1); |
|
2700 | + $index = $entry * ($count - 1); |
|
2701 | 2701 | $iBase = floor($index); |
2702 | 2702 | if ($index == $iBase) { |
2703 | 2703 | return $mArgs[$index]; |
2704 | 2704 | } else { |
2705 | 2705 | $iNext = $iBase + 1; |
2706 | 2706 | $iProportion = $index - $iBase; |
2707 | - return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion) ; |
|
2707 | + return $mArgs[$iBase] + (($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion); |
|
2708 | 2708 | } |
2709 | 2709 | } |
2710 | 2710 | } |
@@ -2816,9 +2816,9 @@ discard block |
||
2816 | 2816 | for ($i = 0; $i <= floor($value); ++$i) { |
2817 | 2817 | $summer += pow($mean, $i) / MathTrig::FACT($i); |
2818 | 2818 | } |
2819 | - return exp(0-$mean) * $summer; |
|
2819 | + return exp(0 - $mean) * $summer; |
|
2820 | 2820 | } else { |
2821 | - return (exp(0-$mean) * pow($mean, $value)) / MathTrig::FACT($value); |
|
2821 | + return (exp(0 - $mean) * pow($mean, $value)) / MathTrig::FACT($value); |
|
2822 | 2822 | } |
2823 | 2823 | } |
2824 | 2824 | } |
@@ -2954,7 +2954,7 @@ discard block |
||
2954 | 2954 | } |
2955 | 2955 | |
2956 | 2956 | if ($count > 2) { |
2957 | - return $summer * ($count / (($count-1) * ($count-2))); |
|
2957 | + return $summer * ($count / (($count - 1) * ($count - 2))); |
|
2958 | 2958 | } |
2959 | 2959 | return Functions::DIV0(); |
2960 | 2960 | } |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | if ($stdDev <= 0) { |
3051 | 3051 | return Functions::NAN(); |
3052 | 3052 | } |
3053 | - return ($value - $mean) / $stdDev ; |
|
3053 | + return ($value - $mean) / $stdDev; |
|
3054 | 3054 | } |
3055 | 3055 | return Functions::VALUE(); |
3056 | 3056 | } |
@@ -3294,7 +3294,7 @@ discard block |
||
3294 | 3294 | public static function TDIST($value, $degrees, $tails) |
3295 | 3295 | { |
3296 | 3296 | $value = Functions::flattenSingleValue($value); |
3297 | - $degrees = floor(Functions::flattenSingleValue($degrees)); |
|
3297 | + $degrees = floor(Functions::flattenSingleValue($degrees)); |
|
3298 | 3298 | $tails = floor(Functions::flattenSingleValue($tails)); |
3299 | 3299 | |
3300 | 3300 | if ((is_numeric($value)) && (is_numeric($degrees)) && (is_numeric($tails))) { |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | $xHi = 0; |
3365 | 3365 | |
3366 | 3366 | $x = $xNew = 1; |
3367 | - $dx = 1; |
|
3367 | + $dx = 1; |
|
3368 | 3368 | $i = 0; |
3369 | 3369 | |
3370 | 3370 | while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { |
@@ -3469,7 +3469,7 @@ discard block |
||
3469 | 3469 | } |
3470 | 3470 | $discard = floor(self::COUNT($mArgs) * $percent / 2); |
3471 | 3471 | sort($mArgs); |
3472 | - for ($i=0; $i < $discard; ++$i) { |
|
3472 | + for ($i = 0; $i < $discard; ++$i) { |
|
3473 | 3473 | array_pop($mArgs); |
3474 | 3474 | array_shift($mArgs); |
3475 | 3475 | } |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | |
34 | 34 | private static function unicodeToOrd($c) |
35 | 35 | { |
36 | - if (ord($c{0}) >=0 && ord($c{0}) <= 127) { |
|
36 | + if (ord($c{0}) >= 0 && ord($c{0}) <= 127) { |
|
37 | 37 | return ord($c{0}); |
38 | 38 | } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) { |
39 | - return (ord($c{0})-192)*64 + (ord($c{1})-128); |
|
39 | + return (ord($c{0}) - 192) * 64 + (ord($c{1}) - 128); |
|
40 | 40 | } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) { |
41 | - return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); |
|
41 | + return (ord($c{0}) - 224) * 4096 + (ord($c{1}) - 128) * 64 + (ord($c{2}) - 128); |
|
42 | 42 | } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) { |
43 | - return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); |
|
43 | + return (ord($c{0}) - 240) * 262144 + (ord($c{1}) - 128) * 4096 + (ord($c{2}) - 128) * 64 + (ord($c{3}) - 128); |
|
44 | 44 | } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) { |
45 | - return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); |
|
45 | + return (ord($c{0}) - 248) * 16777216 + (ord($c{1}) - 128) * 262144 + (ord($c{2}) - 128) * 4096 + (ord($c{3}) - 128) * 64 + (ord($c{4}) - 128); |
|
46 | 46 | } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) { |
47 | - return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); |
|
47 | + return (ord($c{0}) - 252) * 1073741824 + (ord($c{1}) - 128) * 16777216 + (ord($c{2}) - 128) * 262144 + (ord($c{3}) - 128) * 4096 + (ord($c{4}) - 128) * 64 + (ord($c{5}) - 128); |
|
48 | 48 | } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) { |
49 | 49 | // error |
50 | 50 | return Functions::VALUE(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | if (function_exists('mb_convert_encoding')) { |
70 | - return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES'); |
|
70 | + return mb_convert_encoding('&#' . intval($character) . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
71 | 71 | } else { |
72 | 72 | return chr(intval($character)); |
73 | 73 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function TRIMNONPRINTABLE($stringValue = '') |
84 | 84 | { |
85 | - $stringValue = Functions::flattenSingleValue($stringValue); |
|
85 | + $stringValue = Functions::flattenSingleValue($stringValue); |
|
86 | 86 | |
87 | 87 | if (is_bool($stringValue)) { |
88 | 88 | return ($stringValue) ? \PHPExcel\Calculation::getTRUE() : \PHPExcel\Calculation::getFALSE(); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | if (($characters === null) || ($characters === '')) { |
131 | 131 | return Functions::VALUE(); |
132 | 132 | } |
133 | - $characters = Functions::flattenSingleValue($characters); |
|
133 | + $characters = Functions::flattenSingleValue($characters); |
|
134 | 134 | if (is_bool($characters)) { |
135 | 135 | if (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE) { |
136 | 136 | $characters = (int) $characters; |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public static function DOLLAR($value = 0, $decimals = 2) |
196 | 196 | { |
197 | - $value = Functions::flattenSingleValue($value); |
|
198 | - $decimals = is_null($decimals) ? 0 : Functions::flattenSingleValue($decimals); |
|
197 | + $value = Functions::flattenSingleValue($value); |
|
198 | + $decimals = is_null($decimals) ? 0 : Functions::flattenSingleValue($decimals); |
|
199 | 199 | |
200 | 200 | // Validate parameters |
201 | 201 | if (!is_numeric($value) || !is_numeric($decimals)) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } else { |
210 | 210 | $round = pow(10, abs($decimals)); |
211 | 211 | if ($value < 0) { |
212 | - $round = 0-$round; |
|
212 | + $round = 0 - $round; |
|
213 | 213 | } |
214 | 214 | $value = MathTrig::MROUND($value, $round); |
215 | 215 | } |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | $chars = Functions::flattenSingleValue($chars); |
513 | 513 | $newText = Functions::flattenSingleValue($newText); |
514 | 514 | |
515 | - $left = self::LEFT($oldText, $start-1); |
|
516 | - $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1); |
|
515 | + $left = self::LEFT($oldText, $start - 1); |
|
516 | + $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText) - ($start + $chars) + 1); |
|
517 | 517 | |
518 | - return $left.$newText.$right; |
|
518 | + return $left . $newText . $right; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | $pos = -1; |
546 | 546 | while ($instance > 0) { |
547 | 547 | if (function_exists('mb_strpos')) { |
548 | - $pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8'); |
|
548 | + $pos = mb_strpos($text, $fromText, $pos + 1, 'UTF-8'); |
|
549 | 549 | } else { |
550 | - $pos = strpos($text, $fromText, $pos+1); |
|
550 | + $pos = strpos($text, $fromText, $pos + 1); |
|
551 | 551 | } |
552 | 552 | if ($pos === false) { |
553 | 553 | break; |
@@ -63,28 +63,28 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($sheetText > '') { |
65 | 65 | if (strpos($sheetText, ' ') !== false) { |
66 | - $sheetText = "'".$sheetText."'"; |
|
66 | + $sheetText = "'" . $sheetText . "'"; |
|
67 | 67 | } |
68 | - $sheetText .='!'; |
|
68 | + $sheetText .= '!'; |
|
69 | 69 | } |
70 | 70 | if ((!is_bool($referenceStyle)) || $referenceStyle) { |
71 | 71 | $rowRelative = $columnRelative = '$'; |
72 | - $column = \PHPExcel\Cell::stringFromColumnIndex($column-1); |
|
72 | + $column = \PHPExcel\Cell::stringFromColumnIndex($column - 1); |
|
73 | 73 | if (($relativity == 2) || ($relativity == 4)) { |
74 | 74 | $columnRelative = ''; |
75 | 75 | } |
76 | 76 | if (($relativity == 3) || ($relativity == 4)) { |
77 | 77 | $rowRelative = ''; |
78 | 78 | } |
79 | - return $sheetText.$columnRelative.$column.$rowRelative.$row; |
|
79 | + return $sheetText . $columnRelative . $column . $rowRelative . $row; |
|
80 | 80 | } else { |
81 | 81 | if (($relativity == 2) || ($relativity == 4)) { |
82 | - $column = '['.$column.']'; |
|
82 | + $column = '[' . $column . ']'; |
|
83 | 83 | } |
84 | 84 | if (($relativity == 3) || ($relativity == 4)) { |
85 | - $row = '['.$row.']'; |
|
85 | + $row = '[' . $row . ']'; |
|
86 | 86 | } |
87 | - return $sheetText.'R'.$row.'C'.$column; |
|
87 | + return $sheetText . 'R' . $row . 'C' . $column; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $args = func_get_args(); |
263 | 263 | $pCell = array_pop($args); |
264 | 264 | |
265 | - $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
265 | + $linkURL = (is_null($linkURL)) ? '' : Functions::flattenSingleValue($linkURL); |
|
266 | 266 | $displayName = (is_null($displayName)) ? '' : Functions::flattenSingleValue($displayName); |
267 | 267 | |
268 | 268 | if ((!is_object($pCell)) || (trim($linkURL) == '')) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function INDIRECT($cellAddress = null, \PHPExcel\Cell $pCell = null) |
302 | 302 | { |
303 | - $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
303 | + $cellAddress = Functions::flattenSingleValue($cellAddress); |
|
304 | 304 | if (is_null($cellAddress) || $cellAddress === '') { |
305 | 305 | return Functions::REF(); |
306 | 306 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | list($cellAddress1, $cellAddress2) = explode(':', $cellAddress); |
312 | 312 | } |
313 | 313 | |
314 | - if ((!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || |
|
315 | - ((!is_null($cellAddress2)) && (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { |
|
316 | - if (!preg_match('/^'.\PHPExcel\Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { |
|
314 | + if ((!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress1, $matches)) || |
|
315 | + ((!is_null($cellAddress2)) && (!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $cellAddress2, $matches)))) { |
|
316 | + if (!preg_match('/^' . \PHPExcel\Calculation::CALCULATION_REGEXP_NAMEDRANGE . '$/i', $cellAddress1, $matches)) { |
|
317 | 317 | return Functions::REF(); |
318 | 318 | } |
319 | 319 | |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | } |
421 | 421 | $endCellColumn = \PHPExcel\Cell::stringFromColumnIndex($endCellColumn); |
422 | 422 | |
423 | - $cellAddress = $startCellColumn.$startCellRow; |
|
423 | + $cellAddress = $startCellColumn . $startCellRow; |
|
424 | 424 | if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) { |
425 | - $cellAddress .= ':'.$endCellColumn.$endCellRow; |
|
425 | + $cellAddress .= ':' . $endCellColumn . $endCellRow; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | if ($sheetName !== null) { |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | { |
498 | 498 | $lookup_array = Functions::flattenArray($lookup_array); |
499 | 499 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
500 | - $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
500 | + $match_type = (is_null($match_type)) ? 1 : (int) Functions::flattenSingleValue($match_type); |
|
501 | 501 | // MATCH is not case sensitive |
502 | 502 | $lookup_value = strtolower($lookup_value); |
503 | 503 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $lookup_array[$i] = strtolower($lookupArrayValue); |
530 | 530 | } |
531 | 531 | if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) { |
532 | - $lookup_array = array_slice($lookup_array, 0, $i-1); |
|
532 | + $lookup_array = array_slice($lookup_array, 0, $i - 1); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | break; |
558 | 558 | } else { |
559 | 559 | // the previous cell was the match |
560 | - return $keySet[$i-1]+1; |
|
560 | + return $keySet[$i - 1] + 1; |
|
561 | 561 | } |
562 | 562 | } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) { |
563 | 563 | $i = array_search($i, $keySet); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | break; |
568 | 568 | } else { |
569 | 569 | // the previous cell was the match |
570 | - return $keySet[$i-1]+1; |
|
570 | + return $keySet[$i - 1] + 1; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | { |
756 | 756 | $lookup_value = Functions::flattenSingleValue($lookup_value); |
757 | 757 | $index_number = Functions::flattenSingleValue($index_number); |
758 | - $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
758 | + $not_exact_match = Functions::flattenSingleValue($not_exact_match); |
|
759 | 759 | |
760 | 760 | // index_number must be greater than or equal to 1 |
761 | 761 | if ($index_number < 1) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | private static function romanCut($num, $n) |
59 | 59 | { |
60 | - return ($num - ($num % $n ) ) / $n; |
|
60 | + return ($num - ($num % $n)) / $n; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $yCoordinate = ($yCoordinate !== null) ? $yCoordinate : 0.0; |
93 | 93 | |
94 | 94 | if (((is_numeric($xCoordinate)) || (is_bool($xCoordinate))) && |
95 | - ((is_numeric($yCoordinate))) || (is_bool($yCoordinate))) { |
|
95 | + ((is_numeric($yCoordinate))) || (is_bool($yCoordinate))) { |
|
96 | 96 | $xCoordinate = (float) $xCoordinate; |
97 | 97 | $yCoordinate = (float) $yCoordinate; |
98 | 98 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | if ((is_numeric($number)) && (is_numeric($significance))) { |
137 | - if (($number == 0.0 ) || ($significance == 0.0)) { |
|
137 | + if (($number == 0.0) || ($significance == 0.0)) { |
|
138 | 138 | return 0.0; |
139 | 139 | } elseif (self::SIGN($number) == self::SIGN($significance)) { |
140 | 140 | return ceil($number / $significance) * $significance; |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public static function COMBIN($numObjs, $numInSet) |
165 | 165 | { |
166 | - $numObjs = Functions::flattenSingleValue($numObjs); |
|
167 | - $numInSet = Functions::flattenSingleValue($numInSet); |
|
166 | + $numObjs = Functions::flattenSingleValue($numObjs); |
|
167 | + $numInSet = Functions::flattenSingleValue($numInSet); |
|
168 | 168 | |
169 | 169 | if ((is_numeric($numObjs)) && (is_numeric($numInSet))) { |
170 | 170 | if ($numObjs < $numInSet) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public static function FACT($factVal) |
231 | 231 | { |
232 | - $factVal = Functions::flattenSingleValue($factVal); |
|
232 | + $factVal = Functions::flattenSingleValue($factVal); |
|
233 | 233 | |
234 | 234 | if (is_numeric($factVal)) { |
235 | 235 | if ($factVal < 0) { |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | while ($factLoop > 1) { |
247 | 247 | $factorial *= $factLoop--; |
248 | 248 | } |
249 | - return $factorial ; |
|
249 | + return $factorial; |
|
250 | 250 | } |
251 | 251 | return Functions::VALUE(); |
252 | 252 | } |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public static function FACTDOUBLE($factVal) |
269 | 269 | { |
270 | - $factLoop = Functions::flattenSingleValue($factVal); |
|
270 | + $factLoop = Functions::flattenSingleValue($factVal); |
|
271 | 271 | |
272 | 272 | if (is_numeric($factLoop)) { |
273 | - $factLoop = floor($factLoop); |
|
273 | + $factLoop = floor($factLoop); |
|
274 | 274 | if ($factVal < 0) { |
275 | 275 | return Functions::NAN(); |
276 | 276 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $factorial *= $factLoop--; |
280 | 280 | --$factLoop; |
281 | 281 | } |
282 | - return $factorial ; |
|
282 | + return $factorial; |
|
283 | 283 | } |
284 | 284 | return Functions::VALUE(); |
285 | 285 | } |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public static function FLOOR($number, $significance = null) |
303 | 303 | { |
304 | - $number = Functions::flattenSingleValue($number); |
|
305 | - $significance = Functions::flattenSingleValue($significance); |
|
304 | + $number = Functions::flattenSingleValue($number); |
|
305 | + $significance = Functions::flattenSingleValue($significance); |
|
306 | 306 | |
307 | 307 | if ((is_null($significance)) && |
308 | 308 | (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_GNUMERIC)) { |
309 | - $significance = $number/abs($number); |
|
309 | + $significance = $number / abs($number); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | if ((is_numeric($number)) && (is_numeric($significance))) { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | $mergedArray = $allValuesFactors[0]; |
366 | - for ($i=1; $i < $allValuesCount; ++$i) { |
|
366 | + for ($i = 1; $i < $allValuesCount; ++$i) { |
|
367 | 367 | $mergedArray = array_intersect_key($mergedArray, $allValuesFactors[$i]); |
368 | 368 | } |
369 | 369 | $mergedArrayValues = count($mergedArray); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public static function INT($number) |
419 | 419 | { |
420 | - $number = Functions::flattenSingleValue($number); |
|
420 | + $number = Functions::flattenSingleValue($number); |
|
421 | 421 | |
422 | 422 | if (is_null($number)) { |
423 | 423 | return 0; |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public static function logBase($number = null, $base = 10) |
502 | 502 | { |
503 | - $number = Functions::flattenSingleValue($number); |
|
504 | - $base = (is_null($base)) ? 10 : (float) Functions::flattenSingleValue($base); |
|
503 | + $number = Functions::flattenSingleValue($number); |
|
504 | + $base = (is_null($base)) ? 10 : (float) Functions::flattenSingleValue($base); |
|
505 | 505 | |
506 | 506 | if ((!is_numeric($base)) || (!is_numeric($number))) { |
507 | 507 | return Functions::VALUE(); |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | |
928 | 928 | public static function ROMAN($aValue, $style = 0) |
929 | 929 | { |
930 | - $aValue = Functions::flattenSingleValue($aValue); |
|
931 | - $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style); |
|
930 | + $aValue = Functions::flattenSingleValue($aValue); |
|
931 | + $style = (is_null($style)) ? 0 : (integer) Functions::flattenSingleValue($style); |
|
932 | 932 | if ((!is_numeric($aValue)) || ($aValue < 0) || ($aValue >= 4000)) { |
933 | 933 | return Functions::VALUE(); |
934 | 934 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $t = self::romanCut($aValue, 10); |
955 | 955 | $aValue %= 10; |
956 | 956 | |
957 | - return $roman.$mill[$m].$cent[$c].$tens[$t].$ones[$aValue]; |
|
957 | + return $roman . $mill[$m] . $cent[$c] . $tens[$t] . $ones[$aValue]; |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | */ |
1061 | 1061 | public static function SIGN($number) |
1062 | 1062 | { |
1063 | - $number = Functions::flattenSingleValue($number); |
|
1063 | + $number = Functions::flattenSingleValue($number); |
|
1064 | 1064 | |
1065 | 1065 | if (is_bool($number)) { |
1066 | 1066 | return (int) $number; |
@@ -1085,13 +1085,13 @@ discard block |
||
1085 | 1085 | */ |
1086 | 1086 | public static function SQRTPI($number) |
1087 | 1087 | { |
1088 | - $number = Functions::flattenSingleValue($number); |
|
1088 | + $number = Functions::flattenSingleValue($number); |
|
1089 | 1089 | |
1090 | 1090 | if (is_numeric($number)) { |
1091 | 1091 | if ($number < 0) { |
1092 | 1092 | return Functions::NAN(); |
1093 | 1093 | } |
1094 | - return sqrt($number * M_PI) ; |
|
1094 | + return sqrt($number * M_PI); |
|
1095 | 1095 | } |
1096 | 1096 | return Functions::VALUE(); |
1097 | 1097 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
1205 | 1205 | } |
1206 | 1206 | |
1207 | - $testCondition = '='.$arg.$condition; |
|
1207 | + $testCondition = '=' . $arg . $condition; |
|
1208 | 1208 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
1209 | 1209 | // Is it a value within our criteria |
1210 | 1210 | $returnValue += $sumArgs[$key]; |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | if (!is_numeric($arg)) { |
1252 | 1252 | $arg = \PHPExcel\Calculation::wrapResult(strtoupper($arg)); |
1253 | 1253 | } |
1254 | - $testCondition = '='.$arg.$condition; |
|
1254 | + $testCondition = '=' . $arg . $condition; |
|
1255 | 1255 | if (\PHPExcel\Calculation::getInstance()->_calculateFormulaValue($testCondition)) { |
1256 | 1256 | // Is it a value within our criteria |
1257 | 1257 | $returnValue += $sumArgs[$key]; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | $wrkArray = Functions::flattenArray(array_shift($arrayList)); |
1282 | 1282 | $wrkCellCount = count($wrkArray); |
1283 | 1283 | |
1284 | - for ($i=0; $i< $wrkCellCount; ++$i) { |
|
1284 | + for ($i = 0; $i < $wrkCellCount; ++$i) { |
|
1285 | 1285 | if ((!is_numeric($wrkArray[$i])) || (is_string($wrkArray[$i]))) { |
1286 | 1286 | $wrkArray[$i] = 0; |
1287 | 1287 | } |
@@ -1421,8 +1421,8 @@ discard block |
||
1421 | 1421 | */ |
1422 | 1422 | public static function TRUNC($value = 0, $digits = 0) |
1423 | 1423 | { |
1424 | - $value = Functions::flattenSingleValue($value); |
|
1425 | - $digits = Functions::flattenSingleValue($digits); |
|
1424 | + $value = Functions::flattenSingleValue($value); |
|
1425 | + $digits = Functions::flattenSingleValue($digits); |
|
1426 | 1426 | |
1427 | 1427 | // Validate parameters |
1428 | 1428 | if ((!is_numeric($value)) || (!is_numeric($digits))) { |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | // Truncate |
1434 | 1434 | $adjust = pow(10, $digits); |
1435 | 1435 | |
1436 | - if (($digits > 0) && (rtrim(intval((abs($value) - abs(intval($value))) * $adjust), '0') < $adjust/10)) { |
|
1436 | + if (($digits > 0) && (rtrim(intval((abs($value) - abs(intval($value))) * $adjust), '0') < $adjust / 10)) { |
|
1437 | 1437 | return $value; |
1438 | 1438 | } |
1439 | 1439 |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | case 'integer': |
550 | 550 | return $value; |
551 | 551 | case 'boolean': |
552 | - return (integer)$value; |
|
552 | + return (integer) $value; |
|
553 | 553 | case 'string': |
554 | 554 | // Errors |
555 | 555 | if ((strlen($value) > 0) && ($value{0} == '#')) { |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | public static function flattenArray($array) |
621 | 621 | { |
622 | 622 | if (!is_array($array)) { |
623 | - return (array)$array; |
|
623 | + return (array) $array; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | $arrayValues = array(); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | public static function flattenArrayIndexed($array) |
654 | 654 | { |
655 | 655 | if (!is_array($array)) { |
656 | - return (array)$array; |
|
656 | + return (array) $array; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | $arrayValues = array(); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | return $ret; |
739 | 739 | } |
740 | 740 | |
741 | - foreach ((array)$search as $key => $s) { |
|
741 | + foreach ((array) $search as $key => $s) { |
|
742 | 742 | if ($s == '' && $s !== 0) { |
743 | 743 | continue; |
744 | 744 | } |