Files
firefly-iii/app/Repositories/Bill/BillRepositoryInterface.php

178 lines
4.2 KiB
PHP
Raw Normal View History

2015-02-25 15:19:14 +01:00
<?php
namespace FireflyIII\Repositories\Bill;
2015-03-03 17:40:17 +01:00
use Carbon\Carbon;
2015-02-25 15:19:14 +01:00
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
2015-04-05 18:20:06 +02:00
use Illuminate\Support\Collection;
2015-02-25 15:19:14 +01:00
/**
* Interface BillRepositoryInterface
*
* @package FireflyIII\Repositories\Bill
*/
2015-03-29 21:27:51 +02:00
interface BillRepositoryInterface
{
2015-02-25 15:19:14 +01:00
2015-07-09 09:41:54 +02:00
/**
* Takes the paid/unpaid bills collection set up before and expands it using
* credit cards the user might have.
*
* @param Collection $set
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getCreditCardInfoForChart(Collection $set, Carbon $start, Carbon $end);
/**
* Gets a collection of paid bills and a collection of unpaid bills to be used
* in the pie chart on the front page.
*
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getBillsForChart(Carbon $start, Carbon $end);
2015-05-17 10:01:47 +02:00
/**
2015-12-26 09:40:24 +01:00
* @deprecated
2015-05-17 10:01:47 +02:00
* Returns the sum of all payments connected to this bill between the dates.
*
* @param Bill $bill
* @param Carbon $start
* @param Carbon $end
*
* @return float
*/
public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end);
2015-12-26 09:39:35 +01:00
/**
* This method returns all active bills which have been paid for in the given range,
* with the field "paid" indicating how much the bill was for.
*
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function billsPaidInRange(Carbon $start, Carbon $end);
2015-04-07 10:14:10 +02:00
/**
* Create a fake bill to help the chart controller.
*
* @param string $description
* @param Carbon $date
* @param float $amount
*
* @return Bill
*/
public function createFakeBill($description, Carbon $date, $amount);
2015-02-25 15:19:14 +01:00
/**
* @param Bill $bill
*
2015-04-05 18:20:06 +02:00
* @return mixed
2015-02-25 15:19:14 +01:00
*/
2015-04-05 18:20:06 +02:00
public function destroy(Bill $bill);
/**
* @return Collection
*/
public function getActiveBills();
2015-04-05 18:20:06 +02:00
/**
* @return Collection
*/
public function getBills();
/**
* Gets the bills which have some kind of relevance to the accounts mentioned.
*
* @param Collection $accounts
*
* @return Collection
*/
public function getBillsForAccounts(Collection $accounts);
2015-04-05 18:20:06 +02:00
/**
* @param Bill $bill
*
* @return Collection
*/
public function getJournals(Bill $bill);
2015-04-05 18:20:06 +02:00
2015-04-07 10:14:10 +02:00
/**
* Get all journals that were recorded on this bill between these dates.
*
* @param Bill $bill
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getJournalsInRange(Bill $bill, Carbon $start, Carbon $end);
2015-04-05 18:20:06 +02:00
/**
* @param Bill $bill
*
* @return Collection
*/
public function getPossiblyRelatedJournals(Bill $bill);
2015-02-25 15:19:14 +01:00
2015-03-03 17:40:17 +01:00
/**
* Every bill repeats itself weekly, monthly or yearly (or whatever). This method takes a date-range (usually the view-range of Firefly itself)
* and returns date ranges that fall within the given range; those ranges are the bills expected. When a bill is due on the 14th of the month and
* you give 1st and the 31st of that month as argument, you'll get one response, matching the range of your bill.
*
2015-03-29 21:27:51 +02:00
* @param Bill $bill
2015-03-03 17:40:17 +01:00
* @param Carbon $start
* @param Carbon $end
*
* @return mixed
*/
public function getRanges(Bill $bill, Carbon $start, Carbon $end);
2015-02-25 15:19:14 +01:00
/**
2015-04-05 18:20:06 +02:00
* @param Bill $bill
2015-02-25 15:19:14 +01:00
*
2015-04-05 18:20:06 +02:00
* @return Carbon|null
2015-02-25 15:19:14 +01:00
*/
2015-04-05 18:20:06 +02:00
public function lastFoundMatch(Bill $bill);
2015-02-25 15:19:14 +01:00
2015-04-07 10:14:10 +02:00
2015-02-25 15:19:14 +01:00
/**
2015-04-05 18:20:06 +02:00
* @param Bill $bill
2015-02-25 15:19:14 +01:00
*
2015-05-26 20:59:16 +02:00
* @return \Carbon\Carbon
2015-02-25 15:19:14 +01:00
*/
2015-04-05 18:20:06 +02:00
public function nextExpectedMatch(Bill $bill);
2015-02-25 15:19:14 +01:00
/**
* @param Bill $bill
* @param TransactionJournal $journal
*
* @return bool
*/
public function scan(Bill $bill, TransactionJournal $journal);
2015-04-05 18:20:06 +02:00
/**
* @param array $data
*
* @return Bill
*/
public function store(array $data);
/**
* @param Bill $bill
* @param array $data
*
* @return mixed
*/
public function update(Bill $bill, array $data);
2015-03-29 08:14:32 +02:00
}