Various code cleanup.

This commit is contained in:
James Cole
2017-11-05 19:49:20 +01:00
parent 33d89d52c2
commit d2ab03061f
37 changed files with 95 additions and 247 deletions

View File

@@ -297,7 +297,7 @@ class AccountRepository implements AccountRepositoryInterface
protected function storeInitialBalance(Account $account, array $data): TransactionJournal
{
$amount = strval($data['openingBalance']);
Log::debug(sprintf('Submitted amount is %s',$amount));
Log::debug(sprintf('Submitted amount is %s', $amount));
if (bccomp($amount, '0') === 0) {
return new TransactionJournal;
@@ -326,7 +326,7 @@ class AccountRepository implements AccountRepositoryInterface
$secondAmount = bcmul($amount, '-1');
Log::debug(sprintf('First amount is %s, second amount is %s', $firstAmount, $secondAmount));
if (bccomp($amount,'0') === -1) {
if (bccomp($amount, '0') === -1) {
Log::debug(sprintf('%s is a negative number.', $amount));
$firstAccount = $opposing;
$secondAccount = $account;
@@ -508,8 +508,8 @@ class AccountRepository implements AccountRepositoryInterface
protected function validOpeningBalanceData(array $data): bool
{
$data['openingBalance'] = strval($data['openingBalance'] ?? '');
if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0 &&
isset($data['openingBalanceDate'])) {
if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0
&& isset($data['openingBalanceDate'])) {
Log::debug('Array has valid opening balance data.');
return true;