Created
October 14, 2017 21:58
-
-
Save maks-rafalko/91048c8d0ddf6935e37a5947b48a00fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function calculateExpectedValueAt(DateTimeInterface $date) | |
{ | |
$diffInDays = (int) $this->startedAt->diff($date)->format('%a'); | |
$multiplier = $this->initialValue < $this->targetValue ? 1 : -1; | |
$initialAveragePerDay = $this->calculateInitialAveragePerDay(); | |
- return $this->initialValue + ($initialAveragePerDay * $diffInDays * $multiplier); | |
+ return $this->initialValue + ($initialAveragePerDay * $diffInDays / $multiplier); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment