mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
Various code cleanup.
This commit is contained in:
@@ -86,9 +86,6 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
private function parseAccounts(): void
|
||||
{
|
||||
if (null === $this->accounts) {
|
||||
$this->accounts = new Collection;
|
||||
}
|
||||
if (0 !== $this->accounts->count()) {
|
||||
return;
|
||||
}
|
||||
@@ -121,9 +118,6 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
private function parseBills(): void
|
||||
{
|
||||
if (null === $this->bills) {
|
||||
$this->bills = new Collection;
|
||||
}
|
||||
if (0 !== $this->bills->count()) {
|
||||
return;
|
||||
}
|
||||
@@ -156,9 +150,6 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
private function parseBudgets(): void
|
||||
{
|
||||
if (null === $this->budgets) {
|
||||
$this->budgets = new Collection;
|
||||
}
|
||||
if (0 !== $this->budgets->count()) {
|
||||
return;
|
||||
}
|
||||
@@ -191,9 +182,6 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
private function parseCategories(): void
|
||||
{
|
||||
if (null === $this->categories) {
|
||||
$this->categories = new Collection;
|
||||
}
|
||||
if (0 !== $this->categories->count()) {
|
||||
return;
|
||||
}
|
||||
@@ -284,9 +272,6 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
private function parseTags(): void
|
||||
{
|
||||
if (null === $this->tags) {
|
||||
$this->tags = new Collection;
|
||||
}
|
||||
if (0 !== $this->tags->count()) {
|
||||
return;
|
||||
}
|
||||
@@ -311,7 +296,7 @@ class GenericRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// this is cheating but it works:
|
||||
// this is cheating but it works to initialize the collections.
|
||||
$this->accounts = new Collection;
|
||||
$this->budgets = new Collection;
|
||||
$this->categories = new Collection;
|
||||
|
||||
@@ -79,7 +79,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
$return = [];
|
||||
// transaction data:
|
||||
/** @var array $transactions */
|
||||
/** @var array|null $transactions */
|
||||
$transactions = $this->get('transactions');
|
||||
if (null === $transactions) {
|
||||
return [];
|
||||
@@ -101,7 +101,7 @@ class StoreRequest extends FormRequest
|
||||
{
|
||||
$return = [];
|
||||
// repetition data:
|
||||
/** @var array $repetitions */
|
||||
/** @var array|null $repetitions */
|
||||
$repetitions = $this->get('repetitions');
|
||||
if (null === $repetitions) {
|
||||
return [];
|
||||
|
||||
@@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
$return = [];
|
||||
// repetition data:
|
||||
/** @var array $repetitions */
|
||||
/** @var array|null $repetitions */
|
||||
$repetitions = $this->get('repetitions');
|
||||
if (null === $repetitions) {
|
||||
return null;
|
||||
@@ -126,7 +126,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
$return = [];
|
||||
// transaction data:
|
||||
/** @var array $transactions */
|
||||
/** @var array|null $transactions */
|
||||
$transactions = $this->get('transactions');
|
||||
if (null === $transactions) {
|
||||
return null;
|
||||
|
||||
@@ -150,10 +150,7 @@ class UpdateRequest extends FormRequest
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var int $index
|
||||
* @var array $transaction
|
||||
*/
|
||||
/** @var array $transaction */
|
||||
foreach ($this->get('transactions') as $transaction) {
|
||||
// default response is to update nothing in the transaction:
|
||||
$current = [];
|
||||
|
||||
@@ -117,12 +117,6 @@ class UpdateRequest extends FormRequest
|
||||
$validator->errors()->add('outward_id', 'Inward ID must be different from outward ID.');
|
||||
}
|
||||
|
||||
if (null === $inward) {
|
||||
$validator->errors()->add('inward_id', 'This is not a valid inward journal.');
|
||||
}
|
||||
if (null === $outward) {
|
||||
$validator->errors()->add('inward_id', 'This is not a valid outward journal.');
|
||||
}
|
||||
$inDB = $repository->findSpecificLink($existing->linkType, $inward, $outward);
|
||||
if (null === $inDB) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user