Various code cleanup.

This commit is contained in:
James Cole
2016-12-28 16:45:44 +01:00
parent 71195aa789
commit a37f70947b
9 changed files with 80 additions and 92 deletions

View File

@@ -53,6 +53,8 @@ class ReportHelper implements ReportHelperInterface
* This method generates a full report for the given period on all
* the users bills and their payments.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
*
* Excludes bills which have not had a payment on the mentioned accounts.
*
* @param Carbon $start
@@ -80,8 +82,6 @@ class ReportHelper implements ReportHelperInterface
$billLine->setMin(strval($bill->amount_min));
$billLine->setMax(strval($bill->amount_max));
$billLine->setHit(false);
// is hit in period?
$entry = $journals->filter(
function (Transaction $transaction) use ($bill) {
return $transaction->bill_id === $bill->id;
@@ -94,14 +94,10 @@ class ReportHelper implements ReportHelperInterface
$billLine->setLastHitDate($first->date);
$billLine->setHit(true);
}
// bill is active, or bill is hit:
if ($billLine->isActive() || $billLine->isHit()) {
$collection->addBill($billLine);
}
}
// do some extra filtering.
$collection->filterBills();
return $collection;