chore: reformat code.

This commit is contained in:
James Cole
2023-06-21 12:34:58 +02:00
parent 8d87abde64
commit 3dcb35710b
799 changed files with 23319 additions and 22173 deletions

View File

@@ -66,7 +66,7 @@ class DestroyController extends Controller
*
* Remove the specified resource from storage.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException

View File

@@ -90,8 +90,8 @@ class ListController extends Controller
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/listAccountByCurrency
* Display a list of accounts.
*
* @param Request $request
* @param TransactionCurrency $currency
* @param Request $request
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -127,7 +127,7 @@ class ListController extends Controller
// make paginator:
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.accounts', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.accounts', [$currency->code]) . $this->buildParams());
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
@@ -144,7 +144,7 @@ class ListController extends Controller
*
* Display a listing of the resource.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -164,7 +164,7 @@ class ListController extends Controller
$availableBudgets = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// make paginator:
$paginator = new LengthAwarePaginator($availableBudgets, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.available-budgets', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.available-budgets', [$currency->code]) . $this->buildParams());
/** @var AvailableBudgetTransformer $transformer */
$transformer = app(AvailableBudgetTransformer::class);
@@ -182,7 +182,7 @@ class ListController extends Controller
*
* List all bills
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -207,7 +207,7 @@ class ListController extends Controller
// make paginator:
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.bills', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.bills', [$currency->code]) . $this->buildParams());
/** @var BillTransformer $transformer */
$transformer = app(BillTransformer::class);
@@ -225,7 +225,7 @@ class ListController extends Controller
*
* List all budget limits
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -241,7 +241,7 @@ class ListController extends Controller
$count = $collection->count();
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.budget-limits', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.budget-limits', [$currency->code]) . $this->buildParams());
/** @var BudgetLimitTransformer $transformer */
$transformer = app(BudgetLimitTransformer::class);
@@ -259,7 +259,7 @@ class ListController extends Controller
*
* List all recurring transactions.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -293,7 +293,7 @@ class ListController extends Controller
// make paginator:
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.recurrences', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.recurrences', [$currency->code]) . $this->buildParams());
/** @var RecurrenceTransformer $transformer */
$transformer = app(RecurrenceTransformer::class);
@@ -311,7 +311,7 @@ class ListController extends Controller
*
* List all of them.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -344,7 +344,7 @@ class ListController extends Controller
// make paginator:
$paginator = new LengthAwarePaginator($rules, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.rules.index').$this->buildParams());
$paginator->setPath(route('api.v1.rules.index') . $this->buildParams());
/** @var RuleTransformer $transformer */
$transformer = app(RuleTransformer::class);
@@ -362,9 +362,9 @@ class ListController extends Controller
*
* Show all transactions.
*
* @param Request $request
* @param Request $request
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -400,7 +400,7 @@ class ListController extends Controller
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]).$this->buildParams());
$paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]) . $this->buildParams());
$transactions = $paginator->getCollection();
/** @var TransactionGroupTransformer $transformer */

View File

@@ -84,7 +84,7 @@ class ShowController extends Controller
// slice them:
$currencies = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($currencies, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.index').$this->buildParams());
$paginator->setPath(route('api.v1.currencies.index') . $this->buildParams());
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $defaultCurrency);
@@ -105,7 +105,7 @@ class ShowController extends Controller
*
* Show a currency.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException

View File

@@ -69,7 +69,7 @@ class StoreController extends Controller
*
* Store new currency.
*
* @param StoreRequest $request
* @param StoreRequest $request
*
* @return JsonResponse
* @throws FireflyException

View File

@@ -70,7 +70,7 @@ class UpdateController extends Controller
*
* Disable a currency.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -97,42 +97,13 @@ class UpdateController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/enableCurrency
*
* Enable a currency.
*
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException
*/
public function enable(TransactionCurrency $currency): JsonResponse
{
$this->repository->enable($currency);
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $defaultCurrency);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($currency, $transformer, 'currencies');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/defaultCurrency
*
* Make the currency a default currency.
*
* @param TransactionCurrency $currency
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
@@ -157,14 +128,43 @@ class UpdateController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/enableCurrency
*
* Enable a currency.
*
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException
*/
public function enable(TransactionCurrency $currency): JsonResponse
{
$this->repository->enable($currency);
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $defaultCurrency);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($currency, $transformer, 'currencies');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/updateCurrency
*
* Update a currency.
*
* @param UpdateRequest $request
* @param TransactionCurrency $currency
* @param UpdateRequest $request
* @param TransactionCurrency $currency
*
* @return JsonResponse
* @throws FireflyException