mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup
This commit is contained in:
@@ -45,8 +45,8 @@ class AccountValidator
|
||||
|
||||
public bool $createMode;
|
||||
public string $destError;
|
||||
public ?Account $destination;
|
||||
public ?Account $source;
|
||||
public ?Account $destination;
|
||||
public ?Account $source;
|
||||
public string $sourceError;
|
||||
private AccountRepositoryInterface $accountRepository;
|
||||
private array $combinations;
|
||||
@@ -69,6 +69,14 @@ class AccountValidator
|
||||
$this->accountRepository = app(AccountRepositoryInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
public function getSource(): ?Account
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $transactionType
|
||||
*/
|
||||
@@ -167,21 +175,6 @@ class AccountValidator
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accountType
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function canCreateType(string $accountType): bool
|
||||
{
|
||||
$canCreate = [AccountType::EXPENSE, AccountType::REVENUE, AccountType::INITIAL_BALANCE];
|
||||
if (in_array($accountType, $canCreate, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $accountTypes
|
||||
*
|
||||
@@ -203,6 +196,21 @@ class AccountValidator
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accountType
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function canCreateType(string $accountType): bool
|
||||
{
|
||||
$canCreate = [AccountType::EXPENSE, AccountType::REVENUE, AccountType::INITIAL_BALANCE];
|
||||
if (in_array($accountType, $canCreate, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $validTypes
|
||||
* @param int $accountId
|
||||
@@ -228,12 +236,4 @@ class AccountValidator
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
public function getSource(): ?Account
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user