Various code cleanup.

This commit is contained in:
James Cole
2021-06-12 19:32:34 +02:00
parent 4614625f82
commit 85204de9aa
31 changed files with 52 additions and 62 deletions

View File

@@ -55,7 +55,7 @@ class BudgetList implements BinderInterface
$list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) {
if (empty($list)) {
Log::warning('Budget list count is zero, return 404.');
throw new NotFoundHttpException;
}

View File

@@ -50,7 +50,7 @@ class CategoryList implements BinderInterface
}
$list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) {
if (empty($list)) {
throw new NotFoundHttpException;
}

View File

@@ -52,7 +52,7 @@ class JournalList implements BinderInterface
$collector->withCategoryInformation()->withBudgetInformation()->withTagInformation()->withAccountInformation();
$collector->setJournalIds($list);
$result = $collector->getExtractedJournals();
if (0 === count($result)) {
if (empty($result)) {
throw new NotFoundHttpException;
}
@@ -68,7 +68,7 @@ class JournalList implements BinderInterface
protected static function parseList(string $value): array
{
$list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) {
if (empty($list)) {
throw new NotFoundHttpException;
}

View File

@@ -53,7 +53,7 @@ class TagList implements BinderInterface
$list = array_unique(array_map('\strtolower', explode(',', $value)));
Log::debug('List of tags is', $list);
if (0 === count($list)) {
if (empty($list)) {
Log::error('Tag list is empty.');
throw new NotFoundHttpException;
}

View File

@@ -765,7 +765,7 @@ class ExportDataGenerator
*/
private function mergeTags(array $tags): string
{
if (0 === count($tags)) {
if (empty($tags)) {
return '';
}
$smol = [];

View File

@@ -178,7 +178,7 @@ class OperatorQuerySearch implements SearchInterface
*/
public function searchTransactions(): LengthAwarePaginator
{
if (0 === count($this->getWords()) && 0 === count($this->getOperators())) {
if (empty($this->getWords()) && empty($this->getOperators())) {
return new LengthAwarePaginator([], 0, 5, 1);
}