Closed rikvdh closed 5 years ago
This doesn't really seem like it should be part of the library as this is just a wrapper
around isDebit/isCredit... ? More of an implementation thing as the relevance of isDebit/isCredit is mostly up to the implementation is it not?
I think it could be a valuable convenience function for this library. In my accounting system journal-rules are stored as a positive or negative number which increment or decrement the amount. Instead of:
$amount = ($line->isDebit() ? -$line->getPrice() : $line->getPrice());
I can do just:
$amount = $line->getRelativePrice();
Which seems more readable to me. It's your library, do with my proposal whatever you want. But I think it is a valuable addition for a lot of use-cases.
@rikvdh i guess it's a small addition and although i dont see use cases where the oneliner from your example is non-trivial when using the library, it's also too small of an addition to leave out... :smile:
A lot of times you want to get the relative price, (negative when it is debit or positive when it is credit). A small helper function makes this easier.