diff --git a/Business/Finance/Forecasting/ExponentialSmoothing/ExponentialSmoothing.php b/Business/Finance/Forecasting/ExponentialSmoothing/ExponentialSmoothing.php index c2f82e97b..29d5c78d8 100644 --- a/Business/Finance/Forecasting/ExponentialSmoothing/ExponentialSmoothing.php +++ b/Business/Finance/Forecasting/ExponentialSmoothing/ExponentialSmoothing.php @@ -122,7 +122,7 @@ class ExponentialSmoothing } $sum = 0; - for($i = 0; $i < $length; $i++) { + for ($i = 0; $i < $length; $i++) { $sum += pow($damping, $i); } @@ -140,7 +140,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1]; $tempForecast[$i] = $level[$i]; @@ -172,7 +172,7 @@ class ExponentialSmoothing $forecast = []; $seasonal = []; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i-1] - $level[0]; } @@ -185,7 +185,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1]; @@ -223,7 +223,7 @@ class ExponentialSmoothing $forecast = []; $seasonal = []; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i] / $level[0]; } @@ -236,7 +236,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1]; @@ -282,7 +282,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); $trend[$i] = $beta * ($level[$i] - $level[$i-1]) + (1 - $beta) * $damping * $trend[$i-1]; @@ -320,13 +320,13 @@ class ExponentialSmoothing $seasonal = []; $sum = 0; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; } $trend[0] *= $sum; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i-1] - $level[0]; } @@ -342,7 +342,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); @@ -387,13 +387,13 @@ class ExponentialSmoothing $gamma_ = $gamma * (1 - $alpha); $sum = 0; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; } $trend[0] *= $sum; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i] / $level[0]; } @@ -409,7 +409,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * ($level[$i-1] + $damping * $trend[$i-1]); @@ -459,7 +459,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $level[$i] = $alpha * ($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); $trend[$i] = $beta * ($level[$i] / $level[$i-1]) + (1 - $beta) * pow($trend[$i-1], $damping); @@ -496,13 +496,13 @@ class ExponentialSmoothing $seasonal = []; $sum = 0; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; } $trend[0] *= $sum; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i-1] - $level[0]; } @@ -518,7 +518,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) - $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); @@ -562,13 +562,13 @@ class ExponentialSmoothing $seasonal = []; $sum = 0; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $sum += ($this->data[$cycle] - $this->data[$i]) / $cycle; } $trend[0] *= $sum; - for($i = 1; $i < $cycle+1; $i++) { + for ($i = 1; $i < $cycle+1; $i++) { $seasonal[$i] = $this->data[$i] / $level[0]; } @@ -584,7 +584,7 @@ class ExponentialSmoothing $error = []; $tempForecast = []; - for($i = 1; $i < $dataLength; $i++) { + for ($i = 1; $i < $dataLength; $i++) { $hm = (int) floor(($i-1) % $cycle) + 1; $level[$i] = $alpha * (($i < $dataLength - $future ? $this->data[$i-1] : $tempForecast[$i-1]) / $seasonal[$i]) + (1 - $alpha) * $level[$i-1] * pow($trend[$i-1], $damping); diff --git a/Business/Sales/MarketShareEstimation.php b/Business/Sales/MarketShareEstimation.php index 419d5cb8c..0d9af9ccd 100644 --- a/Business/Sales/MarketShareEstimation.php +++ b/Business/Sales/MarketShareEstimation.php @@ -44,7 +44,7 @@ class MarketShareEstimation { public static function getRankFromMarketShare(int $participants, float $marketShare, float $modifier = 1.0) : int { $sum = 0.0; - for($i = 0; $i < $participants; $i++) { + for ($i = 0; $i < $participants; $i++) { $sum += 1 / pow($i+1, $modifier); } @@ -67,7 +67,7 @@ class MarketShareEstimation { public static function getMarketShareFromRank(int $participants, int $rank, float $modifier = 1.0) : float { $sum = 0.0; - for($i = 0; $i < $participants; $i++) { + for ($i = 0; $i < $participants; $i++) { $sum += 1 / pow($i+1, $modifier); } diff --git a/Math/Matrix/CholeskyDecomposition.php b/Math/Matrix/CholeskyDecomposition.php index 757f4aefd..5941057c4 100644 --- a/Math/Matrix/CholeskyDecomposition.php +++ b/Math/Matrix/CholeskyDecomposition.php @@ -28,9 +28,9 @@ class CholeskyDecomposition $this->L = $M->toArray(); $this->m = $M->getM(); - for($i = 0; $i < $this->m; ++$i) { - for($j = $i; $j < $this->m; ++$j) { - for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) { + for ($i = 0; $i < $this->m; ++$i) { + for ($j = $i; $j < $this->m; ++$j) { + for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) { $sum -= $this->L[$i][$k] * $this->L[$j][$k]; } if ($i == $j) { diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index fa64ecb55..62f780687 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -574,7 +574,7 @@ class Matrix implements \ArrayAccess, \Iterator $mDim = count($b); $matrix = $this->matrix; - for($col = 0; $col < $mDim; $col++) { + for ($col = 0; $col < $mDim; $col++) { $j = $col; $max = $matrix[$j][$j]; diff --git a/Stdlib/Base/SmartDateTime.php b/Stdlib/Base/SmartDateTime.php index f442a6318..22a0a676d 100644 --- a/Stdlib/Base/SmartDateTime.php +++ b/Stdlib/Base/SmartDateTime.php @@ -281,20 +281,20 @@ class SmartDateTime extends \DateTime $daysPreviousMonth = $previousMonth->getDaysOfMonth(); // add difference to $weekStartsWith counting backwards from days of previous month (reorder so that lowest value first) - for($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) { + for ($i = $daysPreviousMonth - $diffToWeekStart; $i < $daysPreviousMonth; $i++) { $days[] = new \DateTime($previousMonth->format('Y') . '-' . $previousMonth->format('m') . '-' . ($i+1)); } // add normal count of current days $daysMonth = $this->getDaysOfMonth(); - for($i = 1; $i <= $daysMonth; $i++) { + for ($i = 1; $i <= $daysMonth; $i++) { $days[] = new \DateTime($this->format('Y') . '-' . $this->format('m') . '-' . ($i)); } // add remaining days to next month (7*6 - difference+count of current month) $remainingDays = 42 - $diffToWeekStart - $daysMonth; $nextMonth = $this->createModify(0, 1); - for($i = 1; $i <= $remainingDays; $i++) { + for ($i = 1; $i <= $remainingDays; $i++) { $days[] = new \DateTime($nextMonth->format('Y') . '-' . $nextMonth->format('m') . '-' . ($i)); } diff --git a/Stdlib/Graph/Tree.php b/Stdlib/Graph/Tree.php index f4122359f..2b271debc 100644 --- a/Stdlib/Graph/Tree.php +++ b/Stdlib/Graph/Tree.php @@ -133,7 +133,7 @@ class Tree extends Graph { $depth = $this->getMaxDepth(); - for($i = 1; $i < $depth; $i++) { + for ($i = 1; $i < $depth; $i++) { $nodes = $this->getLevel($i); callback($nodes); } diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index d3b01b0e4..931e5809f 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -384,7 +384,7 @@ class StringUtils $l = mb_strlen($input, 'UTF-8'); $unique = []; - for($i = 0; $i < $l; $i++) { + for ($i = 0; $i < $l; $i++) { $char = mb_substr($input, $i, 1, 'UTF-8'); if (!array_key_exists($char, $unique)) {