mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 06:01:21 +00:00
Code cleanup and documentation improvements.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AccountController.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
@@ -41,14 +40,15 @@ use League\Fractal\Resource\Item;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
|
||||
/**
|
||||
* Class AccountController
|
||||
* Class AccountController.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface */
|
||||
/** @var CurrencyRepositoryInterface The currency repository */
|
||||
private $currencyRepository;
|
||||
/** @var AccountRepositoryInterface */
|
||||
/** @var AccountRepositoryInterface The account repository */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,8 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Show single instance.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
*
|
||||
@@ -147,6 +149,8 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a new instance.
|
||||
*
|
||||
* @param AccountRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
@@ -198,13 +202,15 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* All the available types.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function mapTypes(string $type): array
|
||||
{
|
||||
$types = [
|
||||
$types = [
|
||||
'all' => [AccountType::DEFAULT, AccountType::CASH, AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE,
|
||||
AccountType::INITIAL_BALANCE, AccountType::BENEFICIARY, AccountType::IMPORT, AccountType::RECONCILIATION,
|
||||
AccountType::LOAN,],
|
||||
@@ -226,10 +232,11 @@ class AccountController extends Controller
|
||||
AccountType::RECONCILIATION => [AccountType::RECONCILIATION],
|
||||
AccountType::LOAN => [AccountType::LOAN],
|
||||
];
|
||||
$return = $types['all'];
|
||||
if (isset($types[$type])) {
|
||||
return $types[$type];
|
||||
$return = $types[$type];
|
||||
}
|
||||
|
||||
return $types['all']; // @codeCoverageIgnore
|
||||
return $return; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user