mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Clean up various code.
This commit is contained in:
@@ -47,6 +47,8 @@ class RecurrenceFormRequest extends FormRequest
|
||||
* Get the data required by the controller.
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
@@ -270,18 +272,18 @@ class RecurrenceFormRequest extends FormRequest
|
||||
$throwError = true;
|
||||
if ('withdrawal' === $type) {
|
||||
$throwError = false;
|
||||
$sourceId = (int)$data['source_id'];
|
||||
$destinationId = (int)$data['withdrawal_destination_id'];
|
||||
$sourceId = (int) $data['source_id'];
|
||||
$destinationId = (int) $data['withdrawal_destination_id'];
|
||||
}
|
||||
if ('deposit' === $type) {
|
||||
$throwError = false;
|
||||
$sourceId = (int)$data['deposit_source_id'];
|
||||
$destinationId = (int)$data['destination_id'];
|
||||
$sourceId = (int) $data['deposit_source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
}
|
||||
if ('transfer' === $type) {
|
||||
$throwError = false;
|
||||
$sourceId = (int)$data['source_id'];
|
||||
$destinationId = (int)$data['destination_id'];
|
||||
$sourceId = (int) $data['source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
}
|
||||
if (true === $throwError) {
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
||||
@@ -292,7 +294,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
|
||||
// do something with result:
|
||||
if (false === $validSource) {
|
||||
$message = (string)trans('validation.generic_invalid_source');
|
||||
$message = (string) trans('validation.generic_invalid_source');
|
||||
$validator->errors()->add('source_id', $message);
|
||||
$validator->errors()->add('deposit_source_id', $message);
|
||||
|
||||
@@ -303,7 +305,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
$validDestination = $accountValidator->validateDestination(['id' => $destinationId]);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
$message = (string)trans('validation.generic_invalid_destination');
|
||||
$message = (string) trans('validation.generic_invalid_destination');
|
||||
$validator->errors()->add('destination_id', $message);
|
||||
$validator->errors()->add('withdrawal_destination_id', $message);
|
||||
}
|
||||
|
Reference in New Issue
Block a user