Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -36,20 +36,8 @@ use Illuminate\Support\Collection;
*/
interface BillRepositoryInterface
{
/**
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function billEndsWith(string $query, int $limit): Collection;
/**
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function billStartsWith(string $query, int $limit): Collection;
/**
@@ -57,132 +45,62 @@ interface BillRepositoryInterface
*/
public function correctOrder(): void;
/**
* @param Bill $bill
*
* @return bool
*/
public function destroy(Bill $bill): bool;
/**
*
*/
public function destroyAll(): void;
/**
* Find a bill by ID.
*
* @param int $billId
*
* @return Bill|null
*/
public function find(int $billId): ?Bill;
/**
* Find bill by parameters.
*
* @param int|null $billId
* @param string|null $billName
*
* @return Bill|null
*/
public function findBill(?int $billId, ?string $billName): ?Bill;
/**
* Find a bill by name.
*
* @param string $name
*
* @return Bill|null
*/
public function findByName(string $name): ?Bill;
/**
* @return Collection
*/
public function getActiveBills(): Collection;
/**
* Get all attachments.
*
* @param Bill $bill
*
* @return Collection
*/
public function getAttachments(Bill $bill): Collection;
/**
* @return Collection
*/
public function getBills(): Collection;
/**
* Gets the bills which have some kind of relevance to the accounts mentioned.
*
* @param Collection $accounts
*
* @return Collection
*/
public function getBillsForAccounts(Collection $accounts): Collection;
/**
* Get all bills with these ID's.
*
* @param array $billIds
*
* @return Collection
*/
public function getByIds(array $billIds): Collection;
/**
* Get text or return empty string.
*
* @param Bill $bill
*
* @return string
*/
public function getNoteText(Bill $bill): string;
/**
* @param Bill $bill
*
* @return array
*/
public function getOverallAverage(Bill $bill): array;
/**
* @param int $size
*
* @return LengthAwarePaginator
*/
public function getPaginator(int $size): LengthAwarePaginator;
/**
* @param Bill $bill
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection;
/**
* Between start and end, tells you on which date(s) the bill is expected to hit.
*
* @param Bill $bill
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection;
/**
* Return all rules for one bill
*
* @param Bill $bill
*
* @return Collection
*/
public function getRulesForBill(Bill $bill): Collection;
@@ -191,122 +109,53 @@ interface BillRepositoryInterface
* 5= billid
*
* 5 => [['id' => 1, 'title' => 'Some rule'],['id' => 2, 'title' => 'Some other rule']]
*
* @param Collection $collection
*
* @return array
*/
public function getRulesForBills(Collection $collection): array;
/**
* @param Bill $bill
* @param Carbon $date
*
* @return array
*/
public function getYearAverage(Bill $bill, Carbon $date): array;
/**
* Link a set of journals to a bill.
*
* @param Bill $bill
* @param array $transactions
*/
public function linkCollectionToBill(Bill $bill, array $transactions): void;
/**
* Given a bill and a date, this method will tell you at which moment this bill expects its next
* transaction. Whether or not it is there already, is not relevant.
*
* @param Bill $bill
* @param Carbon $date
*
* @return Carbon
*/
public function nextDateMatch(Bill $bill, Carbon $date): Carbon;
/**
* @param Bill $bill
* @param Carbon $date
*
* @return Carbon
*/
public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon;
/**
* @param Bill $bill
*
* @return Bill
*/
public function removeObjectGroup(Bill $bill): Bill;
/**
* @param string $query
* @param int $limit
*
* @return Collection
*/
public function searchBill(string $query, int $limit): Collection;
/**
* @param Bill $bill
* @param string $objectGroupTitle
*
* @return Bill
*/
public function setObjectGroup(Bill $bill, string $objectGroupTitle): Bill;
/**
* Set specific piggy bank to specific order.
*
* @param Bill $bill
* @param int $order
*/
public function setOrder(Bill $bill, int $order): void;
/**
* @param User|Authenticatable|null $user
*/
public function setUser(User | Authenticatable | null $user): void;
public function setUser(null|Authenticatable|User $user): void;
/**
* @param array $data
*
* @return Bill
* @throws FireflyException
*/
public function store(array $data): Bill;
/**
* Collect multi-currency of sum of bills already paid.
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function sumPaidInRange(Carbon $start, Carbon $end): array;
/**
* Collect multi-currency of sum of bills yet to pay.
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function sumUnpaidInRange(Carbon $start, Carbon $end): array;
/**
* @param Bill $bill
*/
public function unlinkAll(Bill $bill): void;
/**
* @param Bill $bill
* @param array $data
*
* @return Bill
*/
public function update(Bill $bill, array $data): Bill;
}