mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-06 01:45:22 +00:00
Various code cleanup.
This commit is contained in:
@@ -43,7 +43,6 @@ use Validator;
|
||||
*/
|
||||
class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
@@ -72,6 +71,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param Account $moveTo
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Account $account, Account $moveTo): bool
|
||||
@@ -161,6 +161,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data): Account
|
||||
@@ -222,7 +223,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions as $transaction) {
|
||||
$transaction->amount = bcmul($data['amount'], '-1');
|
||||
if ($transaction->account->accountType->type === AccountType::ASSET) {
|
||||
if (AccountType::ASSET === $transaction->account->accountType->type) {
|
||||
$transaction->amount = $data['amount'];
|
||||
}
|
||||
$transaction->save();
|
||||
@@ -413,6 +414,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param string $name
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function storeOpposingAccount(string $name): Account
|
||||
@@ -511,6 +513,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function updateOpeningBalanceJournal(Account $account, TransactionJournal $journal, array $data): bool
|
||||
|
||||
@@ -33,7 +33,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface AccountRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Moved here from account CRUD.
|
||||
*
|
||||
|
||||
@@ -211,6 +211,7 @@ trait FindAccountsTrait
|
||||
|
||||
/**
|
||||
* @return Account
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function getCashAccount(): Account
|
||||
|
||||
Reference in New Issue
Block a user