Skip to content

Commit

Permalink
when allocating, the one with the largest allocation gets the large s…
Browse files Browse the repository at this point in the history
…hare in asset but also debt
  • Loading branch information
frederikbosch committed Aug 3, 2016
1 parent c3020b0 commit 2a22915
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion spec/MoneySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function allocationExamples()
[5, [3, 7], [2, 3]],
[5, [7, 3], [4, 1]],
[5, [7, 3, 0], [4, 1, 0]],
[-5, [7, 3], [-1, -4]],
[-5, [7, 3], [-3, -2]],
];
}

Expand Down
4 changes: 0 additions & 4 deletions src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,6 @@ public function allocate(array $ratios)
throw new \InvalidArgumentException('Cannot allocate to none. Ratio must be zero or positive');
}

if ($this->isNegative()) {
$ratio = $total - $ratio;
}

$share = $this->getCalculator()->share($this->amount, $ratio, $total);
$results[] = $this->newInstance($share);
$remainder = $this->getCalculator()->subtract($remainder, $share);
Expand Down

0 comments on commit 2a22915

Please sign in to comment.