mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -144,7 +144,6 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function groupExpenseByDestination(array $array): array
|
||||
{
|
||||
@@ -232,7 +231,6 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function groupIncomeBySource(array $array): array
|
||||
{
|
||||
|
@@ -113,6 +113,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
;
|
||||
}
|
||||
|
||||
#[\Deprecated]
|
||||
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string
|
||||
{
|
||||
$amount = '0';
|
||||
|
@@ -377,9 +377,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
|
||||
return;
|
||||
}
|
||||
if (null !== $dbNote) {
|
||||
$dbNote->delete();
|
||||
}
|
||||
$dbNote?->delete();
|
||||
}
|
||||
|
||||
public function getAutoBudget(Budget $budget): ?AutoBudget
|
||||
@@ -389,7 +387,6 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function updateAutoBudget(Budget $budget, array $data): void
|
||||
{
|
||||
@@ -527,11 +524,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
public function firstUseDate(Budget $budget): ?Carbon
|
||||
{
|
||||
$journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first();
|
||||
if (null !== $journal) {
|
||||
return $journal->date;
|
||||
}
|
||||
return $journal?->date;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAttachments(Budget $budget): Collection
|
||||
@@ -570,11 +564,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
public function getNoteText(Budget $budget): ?string
|
||||
{
|
||||
$note = $budget->notes()->first();
|
||||
if (null === $note) {
|
||||
return null;
|
||||
}
|
||||
return $note?->text;
|
||||
|
||||
return $note->text;
|
||||
}
|
||||
|
||||
public function searchBudget(string $query, int $limit): Collection
|
||||
|
@@ -41,6 +41,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf
|
||||
{
|
||||
use UserGroupTrait;
|
||||
|
||||
#[\Deprecated]
|
||||
public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$carbonFormat = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
|
@@ -213,11 +213,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
|
||||
$query = $category->transactionJournals()->orderBy('date', 'ASC');
|
||||
$result = $query->first(['transaction_journals.*']);
|
||||
|
||||
if (null !== $result) {
|
||||
return $result->date;
|
||||
}
|
||||
return $result?->date;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function getFirstTransactionDate(Category $category): ?Carbon
|
||||
@@ -264,11 +261,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
|
||||
public function getNoteText(Category $category): ?string
|
||||
{
|
||||
$dbNote = $category->notes()->first();
|
||||
if (null === $dbNote) {
|
||||
return null;
|
||||
}
|
||||
return $dbNote?->text;
|
||||
|
||||
return $dbNote->text;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,11 +301,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
|
||||
|
||||
$result = $query->first(['transaction_journals.*']);
|
||||
|
||||
if (null !== $result) {
|
||||
return $result->date;
|
||||
}
|
||||
return $result?->date;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -45,6 +45,7 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Override;
|
||||
|
||||
use Safe\Exceptions\JsonException;
|
||||
use function Safe\json_encode;
|
||||
|
||||
/**
|
||||
@@ -65,7 +66,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return string|null
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function currencyInUseAt(TransactionCurrency $currency): ?string
|
||||
{
|
||||
@@ -234,7 +238,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
/**
|
||||
* Find by object, ID or code. Returns user default or system default.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency
|
||||
{
|
||||
|
@@ -166,11 +166,8 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn
|
||||
public function getNoteText(TransactionJournal $journal): ?string
|
||||
{
|
||||
$note = $journal->notes()->first();
|
||||
if (null === $note) {
|
||||
return null;
|
||||
}
|
||||
return $note?->text;
|
||||
|
||||
return $note->text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -431,7 +431,6 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
|
||||
/**
|
||||
* Parse the repetition in a string that is user readable.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function repetitionDescription(RecurrenceRepetition $repetition): string
|
||||
{
|
||||
|
@@ -177,11 +177,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
|
||||
->where('noteable_type', TransactionJournal::class)
|
||||
->first()
|
||||
;
|
||||
if (null === $note) {
|
||||
return null;
|
||||
}
|
||||
return $note?->text;
|
||||
|
||||
return $note->text;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -161,11 +161,8 @@ class UserRepository implements UserRepositoryInterface
|
||||
{
|
||||
/** @var null|Role $role */
|
||||
$role = $user->roles()->first();
|
||||
if (null !== $role) {
|
||||
return $role->name;
|
||||
}
|
||||
return $role?->name;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -379,7 +376,6 @@ class UserRepository implements UserRepositoryInterface
|
||||
* This updates the users email address. Same as changeEmail just without most logging. This makes sure that the
|
||||
* undo/confirm routine can't catch this one. The user is NOT blocked.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @see changeEmail
|
||||
*/
|
||||
|
@@ -97,7 +97,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
||||
/**
|
||||
* Returns all groups the user is member in.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get(): Collection
|
||||
{
|
||||
@@ -137,7 +136,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
||||
if (!$existingGroup instanceof UserGroup) {
|
||||
$exists = false;
|
||||
|
||||
/** @var UserGroup $existingGroup */
|
||||
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
|
||||
}
|
||||
$groupName = sprintf('%s-%s', $user->email, substr(sha1(random_int(1000, 9999).microtime()), 0, 4));
|
||||
@@ -168,7 +166,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
||||
/**
|
||||
* Returns all groups.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAll(): Collection
|
||||
{
|
||||
|
Reference in New Issue
Block a user