Code cleanup

This commit is contained in:
James Cole
2021-03-21 09:15:40 +01:00
parent da1751940e
commit 206845575c
317 changed files with 7418 additions and 7362 deletions

View File

@@ -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;
}
}