mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-03 12:04:28 +00:00
Various PSR12 code cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AccountFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -107,12 +108,12 @@ class AccountFormRequest extends FormRequest
|
||||
'virtual_balance' => 'numeric|nullable|max:1000000000',
|
||||
'currency_id' => 'exists:transaction_currencies,id',
|
||||
'account_number' => 'between:1,255|uniqueAccountNumberForUser|nullable',
|
||||
'account_role' => 'in:' . $accountRoles,
|
||||
'account_role' => 'in:'.$accountRoles,
|
||||
'active' => 'boolean',
|
||||
'cc_type' => 'in:' . $ccPaymentTypes,
|
||||
'cc_type' => 'in:'.$ccPaymentTypes,
|
||||
'amount_currency_id_opening_balance' => 'exists:transaction_currencies,id',
|
||||
'amount_currency_id_virtual_balance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:' . $types,
|
||||
'what' => 'in:'.$types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
];
|
||||
$rules = Location::requestRules($rules);
|
||||
@@ -122,7 +123,7 @@ class AccountFormRequest extends FormRequest
|
||||
if (null !== $account) {
|
||||
// add rules:
|
||||
$rules['id'] = 'belongsToUser:accounts';
|
||||
$rules['name'] = 'required|min:1|uniqueAccountForUser:' . $account->id;
|
||||
$rules['name'] = 'required|min:1|uniqueAccountForUser:'.$account->id;
|
||||
$rules['iban'] = ['iban', 'nullable', new UniqueIban($account, $account->accountType->type)];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AttachmentFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BillStoreRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BillUpdateRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BudgetFormStoreRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -75,7 +76,7 @@ class BudgetFormStoreRequest extends FormRequest
|
||||
/**
|
||||
* Configure the validator instance with special rules for after the basic validation rules.
|
||||
*
|
||||
* @param Validator $validator
|
||||
* @param Validator $validator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BudgetFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -69,7 +70,7 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
$budget = $this->route()->parameter('budget');
|
||||
|
||||
if (null !== $budget) {
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . $budget->id;
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,'.$budget->id;
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -85,7 +86,7 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
/**
|
||||
* Configure the validator instance with special rules for after the basic validation rules.
|
||||
*
|
||||
* @param Validator $validator
|
||||
* @param Validator $validator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BudgetIncomeRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BulkEditJournalRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* CategoryFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -60,7 +61,7 @@ class CategoryFormRequest extends FormRequest
|
||||
$category = $this->route()->parameter('category');
|
||||
|
||||
if (null !== $category) {
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,' . $category->id;
|
||||
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,'.$category->id;
|
||||
}
|
||||
|
||||
// fixed
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ConfigurationRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* CurrencyFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* DeleteAccountFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* EmailFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* JournalLinkRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -45,7 +46,7 @@ class JournalLinkRequest extends FormRequest
|
||||
$return = [];
|
||||
$linkType = $this->get('link_type');
|
||||
$parts = explode('_', $linkType);
|
||||
$return['link_type_id'] = (int) $parts[0];
|
||||
$return['link_type_id'] = (int)$parts[0];
|
||||
$return['transaction_journal_id'] = $this->convertInteger('opposing');
|
||||
$return['notes'] = $this->convertString('notes');
|
||||
$return['direction'] = $parts[1];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LinkTypeFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MassDeleteJournalRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* MassEditJournalRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* NewUserFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ObjectGroupFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PiggyBankStoreRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PiggyBankUpdateRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ProfileFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -191,7 +191,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
$rules = [
|
||||
// mandatory info for recurrence.
|
||||
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
||||
'first_date' => 'required|date|after:' . $today->format('Y-m-d'),
|
||||
'first_date' => 'required|date|after:'.$today->format('Y-m-d'),
|
||||
'repetition_type' => ['required', new ValidRecurrenceRepetitionValue(), new ValidRecurrenceRepetitionType(), 'between:1,20'],
|
||||
'skip' => 'required|numeric|integer|gte:0|lte:31',
|
||||
|
||||
@@ -235,7 +235,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
|
||||
// if ends at date X, set another rule.
|
||||
if ('until_date' === $this->convertString('repetition_end')) {
|
||||
$rules['repeat_until'] = 'required|date|after:' . $tomorrow->format('Y-m-d');
|
||||
$rules['repeat_until'] = 'required|date|after:'.$tomorrow->format('Y-m-d');
|
||||
}
|
||||
|
||||
// switch on type to expand rules for source and destination accounts:
|
||||
@@ -263,7 +263,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
$recurrence = $this->route()->parameter('recurrence');
|
||||
if ($recurrence instanceof Recurrence) {
|
||||
$rules['id'] = 'required|numeric|exists:recurrences,id';
|
||||
$rules['title'] = 'required|between:1,255|uniqueObjectForUser:recurrences,title,' . $recurrence->id;
|
||||
$rules['title'] = 'required|between:1,255|uniqueObjectForUser:recurrences,title,'.$recurrence->id;
|
||||
$rules['first_date'] = 'required|date';
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
/**
|
||||
* Configure the validator instance with special rules for after the basic validation rules.
|
||||
*
|
||||
* @param Validator $validator
|
||||
* @param Validator $validator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -290,7 +290,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
/**
|
||||
* Validates the given account information. Switches on given transaction type.
|
||||
*
|
||||
* @param Validator $validator
|
||||
* @param Validator $validator
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -314,16 +314,16 @@ class RecurrenceFormRequest extends FormRequest
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
||||
case 'withdrawal':
|
||||
$sourceId = (int) $data['source_id'];
|
||||
$destinationId = (int) $data['withdrawal_destination_id'];
|
||||
$sourceId = (int)$data['source_id'];
|
||||
$destinationId = (int)$data['withdrawal_destination_id'];
|
||||
break;
|
||||
case 'deposit':
|
||||
$sourceId = (int) $data['deposit_source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
$sourceId = (int)$data['deposit_source_id'];
|
||||
$destinationId = (int)$data['destination_id'];
|
||||
break;
|
||||
case 'transfer':
|
||||
$sourceId = (int) $data['source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
$sourceId = (int)$data['source_id'];
|
||||
$destinationId = (int)$data['destination_id'];
|
||||
break;
|
||||
}
|
||||
// validate source account.
|
||||
@@ -331,7 +331,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);
|
||||
|
||||
@@ -342,7 +342,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);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ReportFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -55,7 +56,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find((int) $accountId);
|
||||
$account = $repository->find((int)$accountId);
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
@@ -78,7 +79,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $budgetId) {
|
||||
$budget = $repository->find((int) $budgetId);
|
||||
$budget = $repository->find((int)$budgetId);
|
||||
if (null !== $budget) {
|
||||
$collection->push($budget);
|
||||
}
|
||||
@@ -101,7 +102,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find((int) $categoryId);
|
||||
$category = $repository->find((int)$categoryId);
|
||||
if (null !== $category) {
|
||||
$collection->push($category);
|
||||
}
|
||||
@@ -124,7 +125,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find((int) $accountId);
|
||||
$account = $repository->find((int)$accountId);
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
@@ -145,7 +146,7 @@ class ReportFormRequest extends FormRequest
|
||||
{
|
||||
$date = today(config('app.timezone'));
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', (string) $range);
|
||||
$parts = explode(' - ', (string)$range);
|
||||
if (2 === count($parts)) {
|
||||
$string = $parts[1];
|
||||
// validate as date
|
||||
@@ -179,7 +180,7 @@ class ReportFormRequest extends FormRequest
|
||||
{
|
||||
$date = today(config('app.timezone'));
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', (string) $range);
|
||||
$parts = explode(' - ', (string)$range);
|
||||
if (2 === count($parts)) {
|
||||
$string = $parts[0];
|
||||
// validate as date
|
||||
@@ -223,7 +224,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection->push($tag);
|
||||
continue;
|
||||
}
|
||||
$tag = $repository->find((int) $tagTag);
|
||||
$tag = $repository->find((int)$tagTag);
|
||||
if (null !== $tag) {
|
||||
$collection->push($tag);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RuleGroupFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -68,7 +69,7 @@ class RuleGroupFormRequest extends FormRequest
|
||||
$ruleGroup = $this->route()->parameter('ruleGroup');
|
||||
|
||||
if (null !== $ruleGroup) {
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . $ruleGroup->id;
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,'.$ruleGroup->id;
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SelectTransactionsRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -49,8 +50,8 @@ class SelectTransactionsRequest extends FormRequest
|
||||
$today = Carbon::now()->addDay()->format('Y-m-d');
|
||||
|
||||
return [
|
||||
'start' => 'required|date|after:' . $first,
|
||||
'end' => 'required|date|before:' . $today,
|
||||
'start' => 'required|date|after:'.$first,
|
||||
'end' => 'required|date|before:'.$today,
|
||||
'accounts' => 'required',
|
||||
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||
];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TagFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -68,7 +69,7 @@ class TagFormRequest extends FormRequest
|
||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag';
|
||||
if (null !== $tag) {
|
||||
$idRule = 'belongsToUser:tags';
|
||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $tag->id;
|
||||
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,'.$tag->id;
|
||||
}
|
||||
|
||||
$rules = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TestRuleFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -48,7 +49,7 @@ class TestRuleFormRequest extends FormRequest
|
||||
$validTriggers = $this->getTriggers();
|
||||
|
||||
return [
|
||||
'rule-trigger.*' => 'required|min:1|in:' . implode(',', $validTriggers),
|
||||
'rule-trigger.*' => 'required|min:1|in:'.implode(',', $validTriggers),
|
||||
'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* TokenFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* TriggerRecurrenceRequest.php
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserFormRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* UserRegistrationRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
Reference in New Issue
Block a user