Various code cleanup.

This commit is contained in:
James Cole
2023-12-22 20:12:38 +01:00
parent 067d160c13
commit 581e5d7330
69 changed files with 361 additions and 317 deletions

View File

@@ -67,7 +67,9 @@ class EditController extends Controller
}
/**
* Edit account overview.
* Edit account overview. It's complex, but it just has a lot of if/then/else.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*
* @return Factory|Redirector|RedirectResponse|View
*/

View File

@@ -146,7 +146,7 @@ class ReconcileController extends Controller
* @return Redirector|RedirectResponse
*
* @throws DuplicateTransactionException
* */
*/
public function submit(ReconciliationStoreRequest $request, Account $account, Carbon $start, Carbon $end)
{
if (!$this->isEditableAccount($account)) {
@@ -188,7 +188,7 @@ class ReconcileController extends Controller
* Creates a reconciliation group.
*
* @throws DuplicateTransactionException
* */
*/
private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference): string
{
if (!$this->isEditableAccount($account)) {

View File

@@ -76,8 +76,7 @@ class AccountController extends Controller
* Shows the balances for all the user's expense accounts (on the front page).
*
* This chart is (multi) currency aware.
*
* */
*/
public function expenseAccounts(): JsonResponse
{
/** @var Carbon $start */
@@ -380,7 +379,7 @@ class AccountController extends Controller
* Shows overview of account during a single period.
*
* @throws FireflyException
* */
*/
public function period(Account $account, Carbon $start, Carbon $end): JsonResponse
{
$chartData = [];
@@ -416,7 +415,7 @@ class AccountController extends Controller
* TODO this chart is not multi currency aware.
*
* @throws FireflyException
* */
*/
public function report(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
return response()->json($this->accountBalanceChart($accounts, $start, $end));
@@ -426,8 +425,7 @@ class AccountController extends Controller
* Shows the balances for all the user's revenue accounts.
*
* This chart is multi-currency aware.
*
* */
*/
public function revenueAccounts(): JsonResponse
{
/** @var Carbon $start */
@@ -517,7 +515,7 @@ class AccountController extends Controller
/**
* @throws FireflyException
* */
*/
private function periodByCurrency(Carbon $start, Carbon $end, Account $account, TransactionCurrency $currency): array
{
app('log')->debug(sprintf('Now in periodByCurrency("%s", "%s", %s, "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'), $account->id, $currency->code));

View File

@@ -32,6 +32,9 @@ use Illuminate\Routing\Controller as BaseController;
/**
* Class Controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
abstract class Controller extends BaseController
{

View File

@@ -65,7 +65,7 @@ class ReconcileController extends Controller
* Overview of reconciliation.
*
* @throws FireflyException
* */
*/
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
{
$startBalance = $request->get('startBalance');
@@ -165,7 +165,7 @@ class ReconcileController extends Controller
* @return JsonResponse
*
* @throws FireflyException
* */
*/
public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
{
if (null === $start || null === $end) {

View File

@@ -59,6 +59,8 @@ class RecurrenceController extends Controller
/**
* Shows all events for a repetition. Used in calendar.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*
* @throws FireflyException
*/
public function events(Request $request): JsonResponse

View File

@@ -74,7 +74,7 @@ class IndexController extends Controller
* @return Factory|View
*
* @throws FireflyException
* */
*/
public function index()
{
$this->cleanupObjectGroups();

View File

@@ -66,7 +66,7 @@ class ShowController extends Controller
* @return Factory|View
*
* @throws FireflyException
* */
*/
public function show(PiggyBank $piggyBank)
{
/** @var Carbon $end */

View File

@@ -150,6 +150,7 @@ class PreferencesController extends Controller
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function postIndex(Request $request)
{

View File

@@ -66,7 +66,7 @@ class BudgetController extends Controller
* @return Factory|View
*
* @throws FireflyException
* */
*/
public function accountPerBudget(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{
/** @var BudgetReportGenerator $generator */
@@ -257,7 +257,7 @@ class BudgetController extends Controller
* @return string
*
* @throws FireflyException
* */
*/
public function general(Collection $accounts, Carbon $start, Carbon $end)
{
/** @var BudgetReportGenerator $generator */