Various code cleanup.

This commit is contained in:
James Cole
2021-04-07 07:53:05 +02:00
parent 49013264d5
commit eddf0c1200
50 changed files with 138 additions and 152 deletions

View File

@@ -220,7 +220,6 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getAccountsById(array $accountIds): Collection
{
/** @var Collection $result */
$query = $this->user->accounts();
if (0 !== count($accountIds)) {
@@ -240,7 +239,6 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getAccountsByType(array $types): Collection
{
/** @var Collection $result */
$query = $this->user->accounts();
if (0 !== count($types)) {
$query->accountTypeIn($types);
@@ -263,7 +261,6 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getActiveAccountsByType(array $types): Collection
{
/** @var Collection $result */
$query = $this->user->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'account_role');
@@ -324,7 +321,6 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getInactiveAccountsByType(array $types): Collection
{
/** @var Collection $result */
$query = $this->user->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'account_role');

View File

@@ -29,6 +29,7 @@ use FireflyIII\Factory\BillFactory;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Note;
use FireflyIII\Models\Rule;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -200,7 +201,6 @@ class BillRepository implements BillRepositoryInterface
*/
public function getBills(): Collection
{
/** @var Collection $set */
return $this->user->bills()
->orderBy('order', 'ASC')
->orderBy('active', 'DESC')
@@ -549,6 +549,7 @@ class BillRepository implements BillRepositoryInterface
->where('rule_actions.action_type', 'link_to_bill')
->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']);
$array = [];
/** @var Rule $rule */
foreach ($rules as $rule) {
$array[$rule->action_value] = $array[$rule->action_value] ?? [];
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active];

View File

@@ -432,25 +432,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return null;
}
/**
* Return a list of exchange rates with this currency.
*
* @param TransactionCurrency $currency
*
* @return Collection
*/
public function getExchangeRates(TransactionCurrency $currency): Collection
{
/** @var CurrencyExchangeRate $rate */
return $this->user->currencyExchangeRates()
->where(
function (Builder $query) use ($currency) {
$query->where('from_currency_id', $currency->id);
$query->orWhere('to_currency_id', $currency->id);
}
)->get();
}
/**
* @inheritDoc
*/

View File

@@ -207,15 +207,6 @@ interface CurrencyRepositoryInterface
*/
public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate;
/**
* Return a list of exchange rates with this currency.
*
* @param TransactionCurrency $currency
*
* @return Collection
*/
public function getExchangeRates(TransactionCurrency $currency): Collection;
/**
* @param TransactionCurrency $currency
*

View File

@@ -97,7 +97,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
*/
public function getPiggyBankEvents(TransactionJournal $journal): Collection
{
/** @var Collection $set */
/** @var Collection $events */
$events = $journal->piggyBankEvents()->get();
$events->each(
function (PiggyBankEvent $event) {

View File

@@ -278,7 +278,7 @@ class JournalRepository implements JournalRepositoryInterface
}
/**
* @param int $transactionId
* @param int $journalId
*/
public function reconcileById(int $journalId): void
{

View File

@@ -169,7 +169,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
/**
* Returns all the journal links (of a specific type).
*
* @param $linkType
* @param LinkType|null $linkType
*
* @return Collection
*/

View File

@@ -43,7 +43,6 @@ trait CreatesObjectGroups
}
/**
* @param User $user
* @param string $title
*
* @return ObjectGroup|null