mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 04:21:20 +00:00
Various code cleanup.
This commit is contained in:
@@ -33,6 +33,7 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
|
||||
@@ -33,17 +33,18 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class BalanceController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param BalanceReportHelperInterface $helper
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
@@ -53,7 +54,7 @@ class BalanceController extends Controller
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$helper = app(BalanceReportHelperInterface::class);
|
||||
$balance = $helper->getBalanceReport($accounts, $start, $end);
|
||||
|
||||
$result = view('reports.partials.balance', compact('balance'))->render();
|
||||
|
||||
@@ -34,16 +34,16 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class BudgetController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param BudgetReportHelperInterface $helper
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
@@ -54,7 +54,7 @@ class BudgetController extends Controller
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$helper = app(BudgetReportHelperInterface::class);
|
||||
$budgets = $helper->getBudgetReport($start, $end, $accounts);
|
||||
|
||||
$result = view('reports.partials.budgets', compact('budgets'))->render();
|
||||
@@ -63,6 +63,7 @@ class BudgetController extends Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
|
||||
@@ -34,6 +34,7 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
@@ -66,6 +67,7 @@ class CategoryController extends Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
*
|
||||
@@ -99,6 +101,7 @@ class CategoryController extends Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/** @noinspection MoreThanThreeArgumentsInspection */
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Report;
|
||||
@@ -58,6 +59,7 @@ class ExpenseController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the overview per budget.
|
||||
*
|
||||
@@ -104,6 +106,7 @@ class ExpenseController extends Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the overview per category (spent and earned).
|
||||
*
|
||||
@@ -160,6 +163,7 @@ class ExpenseController extends Controller
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overview of spending
|
||||
*
|
||||
@@ -206,6 +210,7 @@ class ExpenseController extends Controller
|
||||
// for period, get spent and earned for each account (by name)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Collection $expense
|
||||
|
||||
@@ -33,16 +33,37 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class OperationsController extends Controller
|
||||
{
|
||||
|
||||
/** @var AccountTaskerInterface */
|
||||
private $tasker;
|
||||
|
||||
/**
|
||||
* @param AccountTaskerInterface $tasker
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// translations:
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->tasker = app(AccountTaskerInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
@@ -53,7 +74,7 @@ class OperationsController extends Controller
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$entries = $tasker->getExpenseReport($start, $end, $accounts);
|
||||
$entries = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||
$type = 'expense-entry';
|
||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
||||
$cache->store($result);
|
||||
@@ -62,15 +83,14 @@ class OperationsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountTaskerInterface $tasker
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
@@ -81,7 +101,7 @@ class OperationsController extends Controller
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$entries = $tasker->getIncomeReport($start, $end, $accounts);
|
||||
$entries = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
$type = 'income-entry';
|
||||
$result = view('reports.partials.income-expenses', compact('entries', 'type'))->render();
|
||||
|
||||
@@ -91,15 +111,14 @@ class OperationsController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountTaskerInterface $tasker
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Collection $accounts
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
// chart properties for cache:
|
||||
$cache = new CacheProperties;
|
||||
@@ -111,8 +130,8 @@ class OperationsController extends Controller
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$incomes = $tasker->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $tasker->getExpenseReport($start, $end, $accounts);
|
||||
$incomes = $this->tasker->getIncomeReport($start, $end, $accounts);
|
||||
$expenses = $this->tasker->getExpenseReport($start, $end, $accounts);
|
||||
$incomeSum = array_sum(
|
||||
array_map(
|
||||
function ($item) {
|
||||
|
||||
Reference in New Issue
Block a user