Various issues fixed (SonarQube)

This commit is contained in:
James Cole
2020-10-26 19:15:57 +01:00
parent e4923a3c69
commit 372c6ac667
57 changed files with 86 additions and 221 deletions

View File

@@ -128,7 +128,7 @@ class AccountRepository implements AccountRepositoryInterface
->where('account_meta.name', 'account_number')
->where('account_meta.data', json_encode($number));
if (count($types) > 0) {
if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types);
}
@@ -152,7 +152,7 @@ class AccountRepository implements AccountRepositoryInterface
{
$query = $this->user->accounts()->where('iban', '!=', '')->whereNotNull('iban');
if (count($types) > 0) {
if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types);
}
@@ -180,7 +180,7 @@ class AccountRepository implements AccountRepositoryInterface
{
$query = $this->user->accounts();
if (count($types) > 0) {
if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types);
}
@@ -260,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
/** @var Collection $result */
$query = $this->user->accounts();
if (count($accountIds) > 0) {
if (!empty($accountIds)) {
$query->whereIn('accounts.id', $accountIds);
}
$query->orderBy('accounts.order', 'ASC');
@@ -279,7 +279,7 @@ class AccountRepository implements AccountRepositoryInterface
{
/** @var Collection $result */
$query = $this->user->accounts();
if (count($types) > 0) {
if (!empty($types)) {
$query->accountTypeIn($types);
}
$query->orderBy('accounts.order', 'ASC');
@@ -303,7 +303,7 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('name', 'account_role');
}, 'attachments']
);
if (count($types) > 0) {
if (!empty($types)) {
$query->accountTypeIn($types);
}
$query->where('active', 1);
@@ -572,7 +572,7 @@ class AccountRepository implements AccountRepositoryInterface
}
}
if (count($types) > 0) {
if (!empty($types)) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$dbQuery->whereIn('account_types.type', $types);
}
@@ -630,7 +630,7 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('name', 'account_role');
}]
);
if (count($types) > 0) {
if (!empty($types)) {
$query->accountTypeIn($types);
}
$query->where('active', 0);
@@ -728,7 +728,7 @@ class AccountRepository implements AccountRepositoryInterface
});
}
}
if (count($types) > 0) {
if (!empty($types)) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$dbQuery->whereIn('account_types.type', $types);
}