Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -43,8 +43,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate list of accounts.
*
* @return Collection
*/
public function getAccountList(): Collection
{
@@ -67,8 +65,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate list of budgets.
*
* @return Collection
*/
public function getBudgetList(): Collection
{
@@ -90,8 +86,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate list of categories.
*
* @return Collection
*/
public function getCategoryList(): Collection
{
@@ -113,8 +107,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate list of accounts which exist twice in system.
*
* @return Collection
*/
public function getDoubleList(): Collection
{
@@ -137,8 +129,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate end date.
*
* @return Carbon
*
* @throws FireflyException
*/
public function getEndDate(): Carbon
@@ -154,26 +144,28 @@ class ReportFormRequest extends FormRequest
if (false !== preg_match($pattern, $string)) {
try {
$date = new Carbon($parts[1]);
} catch (Exception $e) { // intentional generic exception
} catch (\Exception $e) { // intentional generic exception
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
app('log')->error($error);
app('log')->error($e->getTraceAsString());
throw new FireflyException($error, 0, $e);
}
return $date;
}
$error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
app('log')->error($error);
throw new FireflyException($error, 0);
}
return $date;
}
/**
* Validate start date.
*
* @return Carbon
*
* @throws FireflyException
*/
public function getStartDate(): Carbon
@@ -189,16 +181,19 @@ class ReportFormRequest extends FormRequest
if (false !== preg_match($pattern, $string)) {
try {
$date = new Carbon($parts[0]);
} catch (Exception $e) { // intentional generic exception
} catch (\Exception $e) { // intentional generic exception
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
app('log')->error($error);
app('log')->error($e->getTraceAsString());
throw new FireflyException($error, 0, $e);
}
return $date;
}
$error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
app('log')->error($error);
throw new FireflyException($error, 0);
}
@@ -207,8 +202,6 @@ class ReportFormRequest extends FormRequest
/**
* Validate list of tags.
*
* @return Collection
*/
public function getTagList(): Collection
{
@@ -221,6 +214,7 @@ class ReportFormRequest extends FormRequest
}
if (!is_array($set)) {
app('log')->error(sprintf('Set is not an array! "%s"', $set));
return $collection;
}
foreach ($set as $tagTag) {
@@ -228,6 +222,7 @@ class ReportFormRequest extends FormRequest
$tag = $repository->findByTag($tagTag);
if (null !== $tag) {
$collection->push($tag);
continue;
}
$tag = $repository->find((int)$tagTag);
@@ -241,8 +236,6 @@ class ReportFormRequest extends FormRequest
/**
* Rules for this request.
*
* @return array
*/
public function rules(): array
{