Various code cleanup.

This commit is contained in:
James Cole
2021-04-07 07:28:43 +02:00
parent 4ddcb0c965
commit f12744ad8c
180 changed files with 714 additions and 721 deletions

View File

@@ -45,7 +45,7 @@ class ReconciliationStoreRequest extends FormRequest
{
$transactions = $this->get('journals');
if (!is_array($transactions)) {
$transactions = []; // @codeCoverageIgnore
$transactions = [];
}
$data = [
'start' => $this->date('start'),

View File

@@ -109,7 +109,7 @@ class RecurrenceFormRequest extends FormRequest
// fill in source and destination account data
switch ($this->string('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
case 'withdrawal':
$return['transactions'][0]['source_id'] = $this->integer('source_id');
$return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id');
@@ -251,7 +251,7 @@ class RecurrenceFormRequest extends FormRequest
break;
default:
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type')));
}
// update some rules in case the user is editing a post:
@@ -308,7 +308,7 @@ class RecurrenceFormRequest extends FormRequest
switch ($this->string('transaction_type')) {
default:
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));
case 'withdrawal':
$sourceId = (int)$data['source_id'];
$destinationId = (int)$data['withdrawal_destination_id'];

View File

@@ -149,12 +149,12 @@ class ReportFormRequest extends FormRequest
if (2 === count($parts)) {
try {
$date = new Carbon($parts[1]);
// @codeCoverageIgnoreStart
} catch (Exception $e) {
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
Log::error($error);
throw new FireflyException($error);
// @codeCoverageIgnoreEnd
throw new FireflyException($error, 0, $e);
}
}
@@ -177,12 +177,12 @@ class ReportFormRequest extends FormRequest
if (2 === count($parts)) {
try {
$date = new Carbon($parts[0]);
// @codeCoverageIgnoreStart
} catch (Exception $e) {
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
Log::error($error);
throw new FireflyException($error);
// @codeCoverageIgnoreEnd
throw new FireflyException($error, 0, $e);
}
}