mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 04:34:00 +00:00
Code clean up.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Popup;
|
||||
@@ -38,13 +37,10 @@ use Response;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* Class ReportController
|
||||
*
|
||||
* @package FireflyIII\Http\Controllers\Popup
|
||||
* Class ReportController.
|
||||
*/
|
||||
class ReportController extends Controller
|
||||
{
|
||||
|
||||
/** @var AccountRepositoryInterface */
|
||||
private $accountRepository;
|
||||
/** @var BudgetRepositoryInterface */
|
||||
@@ -54,7 +50,6 @@ class ReportController extends Controller
|
||||
/** @var PopupReportInterface */
|
||||
private $popupHelper;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -63,17 +58,16 @@ class ReportController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
// @var AccountRepositoryInterface $repository
|
||||
$this->accountRepository = app(AccountRepositoryInterface::class);
|
||||
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
// @var BudgetRepositoryInterface $repository
|
||||
$this->budgetRepository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
/** @var CategoryRepositoryInterface categoryRepository */
|
||||
// @var CategoryRepositoryInterface categoryRepository
|
||||
$this->categoryRepository = app(CategoryRepositoryInterface::class);
|
||||
|
||||
/** @var PopupReportInterface popupHelper */
|
||||
// @var PopupReportInterface popupHelper
|
||||
$this->popupHelper = app(PopupReportInterface::class);
|
||||
|
||||
return $next($request);
|
||||
@@ -81,11 +75,11 @@ class ReportController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function general(Request $request)
|
||||
@@ -123,6 +117,7 @@ class ReportController extends Controller
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function balanceAmount(array $attributes): string
|
||||
@@ -132,20 +127,20 @@ class ReportController extends Controller
|
||||
$account = $this->accountRepository->find(intval($attributes['accountId']));
|
||||
|
||||
switch (true) {
|
||||
case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)):
|
||||
case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget->id:
|
||||
// normal row with a budget:
|
||||
$journals = $this->popupHelper->balanceForBudget($budget, $account, $attributes);
|
||||
break;
|
||||
case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):
|
||||
case BalanceLine::ROLE_DEFAULTROLE === $role && null === $budget->id:
|
||||
// normal row without a budget:
|
||||
$journals = $this->popupHelper->balanceForNoBudget($account, $attributes);
|
||||
$budget->name = strval(trans('firefly.no_budget'));
|
||||
break;
|
||||
case ($role === BalanceLine::ROLE_DIFFROLE):
|
||||
case BalanceLine::ROLE_DIFFROLE === $role:
|
||||
$journals = $this->popupHelper->balanceDifference($account, $attributes);
|
||||
$budget->name = strval(trans('firefly.leftUnbalanced'));
|
||||
break;
|
||||
case ($role === BalanceLine::ROLE_TAGROLE):
|
||||
case BalanceLine::ROLE_TAGROLE === $role:
|
||||
// row with tag info.
|
||||
throw new FireflyException('Firefly cannot handle this type of info-button (BalanceLine::TagRole)');
|
||||
}
|
||||
@@ -160,6 +155,7 @@ class ReportController extends Controller
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function budgetSpentAmount(array $attributes): string
|
||||
@@ -177,6 +173,7 @@ class ReportController extends Controller
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function categoryEntry(array $attributes): string
|
||||
@@ -194,6 +191,7 @@ class ReportController extends Controller
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function expenseEntry(array $attributes): string
|
||||
@@ -211,6 +209,7 @@ class ReportController extends Controller
|
||||
* @param $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function incomeEntry(array $attributes): string
|
||||
@@ -226,6 +225,7 @@ class ReportController extends Controller
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function parseAttributes(array $attributes): array
|
||||
@@ -244,7 +244,6 @@ class ReportController extends Controller
|
||||
throw new FireflyException('Could not parse start date "' . e($attributes['endDate']) . '".');
|
||||
}
|
||||
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user