Code reordering and reformatting. I should really start employing style CI.

This commit is contained in:
James Cole
2021-09-18 10:26:12 +02:00
parent 9b9d52e99f
commit 4003cea759
344 changed files with 2776 additions and 2605 deletions

View File

@@ -32,6 +32,22 @@ use Log;
*/
trait DepositValidation
{
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
/**
* @param int|null $accountId
* @param mixed $accountName
@@ -78,22 +94,6 @@ trait DepositValidation
return $result;
}
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
/**
* @param int|null $accountId
* @param string|null $accountName

View File

@@ -35,31 +35,6 @@ use Log;
trait LiabilityValidation
{
/**
* Source of an liability credit must be a liability.
*
* @param string|null $accountName
*
* @return bool
*/
protected function validateLCSource(?string $accountName): bool
{
$result = true;
Log::debug(sprintf('Now in validateLCDestination("%s")', $accountName));
if ('' === $accountName || null === $accountName) {
$result = false;
}
if (true === $result) {
// set the source to be a (dummy) revenue account.
$account = new Account;
$accountType = AccountType::whereType(AccountType::LIABILITY_CREDIT)->first();
$account->accountType = $accountType;
$this->source = $account;
}
return $result;
}
/**
* @param int|null $accountId
*
@@ -96,4 +71,29 @@ trait LiabilityValidation
return $result ?? false;
}
/**
* Source of an liability credit must be a liability.
*
* @param string|null $accountName
*
* @return bool
*/
protected function validateLCSource(?string $accountName): bool
{
$result = true;
Log::debug(sprintf('Now in validateLCDestination("%s")', $accountName));
if ('' === $accountName || null === $accountName) {
$result = false;
}
if (true === $result) {
// set the source to be a (dummy) revenue account.
$account = new Account;
$accountType = AccountType::whereType(AccountType::LIABILITY_CREDIT)->first();
$account->accountType = $accountType;
$this->source = $account;
}
return $result;
}
}

View File

@@ -33,6 +33,13 @@ use Log;
*/
trait OBValidation
{
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param int|null $accountId
* @param mixed $accountName
@@ -79,13 +86,6 @@ trait OBValidation
return $result;
}
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* Source of an opening balance can either be an asset account
* or an "initial balance account". The latter can be created.

View File

@@ -31,6 +31,22 @@ use Log;
*/
trait TransferValidation
{
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
/**
* @param int|null $accountId
* @param mixed $accountName
@@ -71,22 +87,6 @@ trait TransferValidation
return true;
}
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
/**
* @param int|null $accountId
* @param string|null $accountName

View File

@@ -32,6 +32,22 @@ use Log;
*/
trait WithdrawalValidation
{
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
/**
* @param int|null $accountId
* @param string|null $accountName
@@ -103,13 +119,6 @@ trait WithdrawalValidation
return true === $this->canCreateTypes($validTypes);
}
/**
* @param array $accountTypes
*
* @return bool
*/
abstract protected function canCreateTypes(array $accountTypes): bool;
/**
* @param int|null $accountId
* @param string|null $accountName
@@ -143,13 +152,4 @@ trait WithdrawalValidation
return true;
}
/**
* @param array $validTypes
* @param int $accountId
* @param string $accountName
*
* @return Account|null
*/
abstract protected function findExistingAccount(array $validTypes, int $accountId, string $accountName): ?Account;
}