Change scope of methods, add some notes. Prep for refactoring.

This commit is contained in:
James Cole
2018-08-09 16:07:33 +02:00
parent 32e58d0a60
commit 7943164375
41 changed files with 189 additions and 147 deletions

View File

@@ -457,7 +457,7 @@ class AccountController extends Controller
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
private function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
{
// chart properties for cache:
$cache = new CacheProperties();
@@ -515,7 +515,7 @@ class AccountController extends Controller
*
* @return array
*/
private function getBudgetNames(array $budgetIds): array
protected function getBudgetNames(array $budgetIds): array // extract info from array.
{
/** @var BudgetRepositoryInterface $repository */
$repository = app(BudgetRepositoryInterface::class);
@@ -539,7 +539,7 @@ class AccountController extends Controller
*
* @return array
*/
private function getCategoryNames(array $categoryIds): array
protected function getCategoryNames(array $categoryIds): array // extract info from array.
{
/** @var CategoryRepositoryInterface $repository */
$repository = app(CategoryRepositoryInterface::class);

View File

@@ -468,7 +468,7 @@ class BudgetController extends Controller
*
* @return array
*/
private function getAccountNames(array $accountIds): array
protected function getAccountNames(array $accountIds): array // extract info from array.
{
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
@@ -494,7 +494,7 @@ class BudgetController extends Controller
*
* @return array
*/
private function getBudgetedInPeriod(Budget $budget, Carbon $start, Carbon $end): array
protected function getBudgetedInPeriod(Budget $budget, Carbon $start, Carbon $end): array // get data + augment with info
{
$key = app('navigation')->preferredCarbonFormat($start, $end);
$range = app('navigation')->preferredRangeFormat($start, $end);
@@ -522,7 +522,7 @@ class BudgetController extends Controller
*
* @return array
*/
private function getCategoryNames(array $categoryIds): array
protected function getCategoryNames(array $categoryIds): array // extract info from arrat
{
/** @var CategoryRepositoryInterface $repository */
$repository = app(CategoryRepositoryInterface::class);
@@ -552,7 +552,7 @@ class BudgetController extends Controller
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
private function getExpensesForBudget(Collection $limits, Budget $budget, Carbon $start, Carbon $end): array
protected function getExpensesForBudget(Collection $limits, Budget $budget, Carbon $start, Carbon $end): array // get data + augment with info
{
$return = [];
if (0 === $limits->count()) {
@@ -595,7 +595,7 @@ class BudgetController extends Controller
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
private function spentInPeriodMulti(Budget $budget, Collection $limits): array
protected function spentInPeriodMulti(Budget $budget, Collection $limits): array // get data + augment with info
{
$return = [];
$format = (string)trans('config.month_and_day');
@@ -643,7 +643,7 @@ class BudgetController extends Controller
*
* @return string
*/
private function spentInPeriodWithout(Carbon $start, Carbon $end): string
protected function spentInPeriodWithout(Carbon $start, Carbon $end): string // get data + augment with info
{
// collector
/** @var JournalCollectorInterface $collector */

View File

@@ -228,7 +228,7 @@ class BudgetReportController extends Controller
*
* @return Collection
*/
private function filterBudgetLimits(Collection $budgetLimits, Budget $budget, Carbon $start, Carbon $end): Collection
protected function filterBudgetLimits(Collection $budgetLimits, Budget $budget, Carbon $start, Carbon $end): Collection // filter data
{
$set = $budgetLimits->filter(
function (BudgetLimit $budgetLimit) use ($budget, $start, $end) {
@@ -257,7 +257,7 @@ class BudgetReportController extends Controller
*
* @return Collection
*/
private function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection
protected function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection // get data + augment with info
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -278,7 +278,7 @@ class BudgetReportController extends Controller
*
* @return array
*/
private function groupByBudget(Collection $set): array
protected function groupByBudget(Collection $set): array // filter + group data
{
// group by category ID:
$grouped = [];

View File

@@ -307,7 +307,7 @@ class CategoryController extends Controller
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
private function makePeriodChart(Category $category, Carbon $start, Carbon $end): array
protected function makePeriodChart(Category $category, Carbon $start, Carbon $end): array // chart helper method.
{
$cache = new CacheProperties;
$cache->addProperty($start);

View File

@@ -302,7 +302,7 @@ class CategoryReportController extends Controller
*
*
*/
private function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
protected function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -327,7 +327,7 @@ class CategoryReportController extends Controller
*
* @return Collection
*/
private function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
protected function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -347,7 +347,7 @@ class CategoryReportController extends Controller
*
* @return array
*/
private function groupByCategory(Collection $set): array
protected function groupByCategory(Collection $set): array // filter + group data
{
// group by category ID:
$grouped = [];

View File

@@ -199,7 +199,7 @@ class ExpenseReportController extends Controller
*
* @return array
*/
protected function combineAccounts(Collection $accounts): array
protected function combineAccounts(Collection $accounts): array // filter + group data
{
$combined = [];
/** @var Account $expenseAccount */
@@ -227,7 +227,7 @@ class ExpenseReportController extends Controller
*
* @return Collection
*/
private function getExpenses(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): Collection
protected function getExpenses(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -246,7 +246,7 @@ class ExpenseReportController extends Controller
*
* @return Collection
*/
private function getIncome(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): Collection
protected function getIncome(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
/** @var JournalCollectorInterface $collector */
@@ -263,7 +263,7 @@ class ExpenseReportController extends Controller
*
* @return array
*/
private function groupByName(Collection $set): array
protected function groupByName(Collection $set): array // filter + group data
{
// group by opposing account name.
$grouped = [];

View File

@@ -222,11 +222,11 @@ class ReportController extends Controller
/**
* Sum up an array.
*
* @param $array
* @param array $array
*
* @return string
*/
private function arraySum($array): string
protected function arraySum(array $array): string // filter + group data
{
$sum = '0';
foreach ($array as $entry) {
@@ -247,7 +247,7 @@ class ReportController extends Controller
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
private function getChartData(Collection $accounts, Carbon $start, Carbon $end): array
protected function getChartData(Collection $accounts, Carbon $start, Carbon $end): array // chart helper function
{
$cache = new CacheProperties;
$cache->addProperty('chart.report.get-chart-data');

View File

@@ -355,7 +355,7 @@ class TagReportController extends Controller
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
private function getExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): Collection
protected function getExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -382,7 +382,7 @@ class TagReportController extends Controller
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
private function getIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): Collection
protected function getIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end): Collection // get data + augument
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -402,7 +402,7 @@ class TagReportController extends Controller
*
* @return array
*/
private function groupByTag(Collection $set): array
protected function groupByTag(Collection $set): array // filter + group data
{
// group by category ID:
$grouped = [];