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

157 lines
3.6 KiB
PHP
Raw Normal View History

2015-02-25 08:19:14 -06:00
<?php
namespace FireflyIII\Repositories\Bill;
2015-03-03 10:40:17 -06:00
use Carbon\Carbon;
2015-02-25 08:19:14 -06:00
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
2015-04-05 11:20:06 -05:00
use Illuminate\Support\Collection;
2015-02-25 08:19:14 -06:00
/**
* Interface BillRepositoryInterface
*
* @package FireflyIII\Repositories\Bill
*/
2015-03-29 14:27:51 -05:00
interface BillRepositoryInterface
{
2015-02-25 08:19:14 -06:00
2015-07-09 02:41:54 -05: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 03:01:47 -05: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-04-07 03:14:10 -05: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 08:19:14 -06:00
/**
* @param Bill $bill
*
2015-04-05 11:20:06 -05:00
* @return mixed
2015-02-25 08:19:14 -06:00
*/
2015-04-05 11:20:06 -05:00
public function destroy(Bill $bill);
/**
* @return Collection
*/
public function getActiveBills();
2015-04-05 11:20:06 -05:00
/**
* @return Collection
*/
public function getBills();
/**
* @param Bill $bill
*
* @return Collection
*/
public function getJournals(Bill $bill);
2015-04-05 11:20:06 -05:00
2015-04-07 03:14:10 -05: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 11:20:06 -05:00
/**
* @param Bill $bill
*
* @return Collection
*/
public function getPossiblyRelatedJournals(Bill $bill);
2015-02-25 08:19:14 -06:00
2015-03-03 10:40:17 -06: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 14:27:51 -05:00
* @param Bill $bill
2015-03-03 10:40:17 -06:00
* @param Carbon $start
* @param Carbon $end
*
* @return mixed
*/
public function getRanges(Bill $bill, Carbon $start, Carbon $end);
2015-02-25 08:19:14 -06:00
/**
2015-04-05 11:20:06 -05:00
* @param Bill $bill
2015-02-25 08:19:14 -06:00
*
2015-04-05 11:20:06 -05:00
* @return Carbon|null
2015-02-25 08:19:14 -06:00
*/
2015-04-05 11:20:06 -05:00
public function lastFoundMatch(Bill $bill);
2015-02-25 08:19:14 -06:00
2015-04-07 03:14:10 -05:00
2015-02-25 08:19:14 -06:00
/**
2015-04-05 11:20:06 -05:00
* @param Bill $bill
2015-02-25 08:19:14 -06:00
*
2015-05-26 13:59:16 -05:00
* @return \Carbon\Carbon
2015-02-25 08:19:14 -06:00
*/
2015-04-05 11:20:06 -05:00
public function nextExpectedMatch(Bill $bill);
2015-02-25 08:19:14 -06:00
/**
* @param Bill $bill
* @param TransactionJournal $journal
*
* @return bool
*/
public function scan(Bill $bill, TransactionJournal $journal);
2015-04-05 11:20:06 -05: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 01:14:32 -05:00
}