mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-30 10:47:06 -06:00
Remove unused code.
This commit is contained in:
parent
c9cfda34a1
commit
bc825a8603
@ -30,14 +30,6 @@ interface CategoryChartGeneratorInterface
|
||||
*/
|
||||
public function all(Collection $entries): array;
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function earnedInPeriod(Collection $categories, Collection $entries): array;
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
*
|
||||
@ -66,11 +58,4 @@ interface CategoryChartGeneratorInterface
|
||||
*/
|
||||
public function pieChart(array $data): array;
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function spentInPeriod(Collection $categories, Collection $entries): array;
|
||||
}
|
||||
|
@ -58,39 +58,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function earnedInPeriod(Collection $categories, Collection $entries): array
|
||||
{
|
||||
|
||||
// language:
|
||||
$format = (string)trans('config.month');
|
||||
|
||||
$data = [
|
||||
'count' => 0,
|
||||
'labels' => [],
|
||||
'datasets' => [],
|
||||
];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$data['labels'][] = $category->name;
|
||||
}
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$date = $entry[0]->formatLocalized($format);
|
||||
array_shift($entry);
|
||||
$data['count']++;
|
||||
$data['datasets'][] = ['label' => $date, 'data' => $entry];
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
*
|
||||
@ -204,36 +171,4 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $entries
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function spentInPeriod(Collection $categories, Collection $entries): array
|
||||
{
|
||||
|
||||
// language:
|
||||
$format = (string)trans('config.month');
|
||||
|
||||
$data = [
|
||||
'count' => 0,
|
||||
'labels' => [],
|
||||
'datasets' => [],
|
||||
];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$data['labels'][] = $category->name;
|
||||
}
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$date = $entry[0]->formatLocalized($format);
|
||||
array_shift($entry);
|
||||
$data['count']++;
|
||||
$data['datasets'][] = ['label' => $date, 'data' => $entry];
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
$accountIds = join(',', $this->accounts->pluck('id')->toArray());
|
||||
$categoryIds = join(',', $this->categories->pluck('id')->toArray());
|
||||
$reportType = 'category';
|
||||
$accountSummary = $this->getAccountSummary();
|
||||
$categorySummary = $this->getCategorySummary();
|
||||
$accountSummary = $this->getObjectSummary($this->getSpentAccountSummary(), $this->getEarnedAccountSummary());
|
||||
$categorySummary = $this->getObjectSummary($this->getSpentCategorySummary(), $this->getEarnedCategorySummary());
|
||||
$averageExpenses = $this->getAverages($this->getExpenses(), SORT_ASC);
|
||||
$averageIncome = $this->getAverages($this->getIncome(), SORT_DESC);
|
||||
$topExpenses = $this->getTopExpenses();
|
||||
@ -129,45 +129,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getAccountSummary(): array
|
||||
{
|
||||
$spent = $this->getSpentAccountSummary();
|
||||
$earned = $this->getEarnedAccountSummary();
|
||||
$return = [];
|
||||
|
||||
/**
|
||||
* @var int $accountId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($spent as $accountId => $entry) {
|
||||
if (!isset($return[$accountId])) {
|
||||
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$accountId]['spent'] = $entry;
|
||||
}
|
||||
unset($entry);
|
||||
|
||||
/**
|
||||
* @var int $accountId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($earned as $accountId => $entry) {
|
||||
if (!isset($return[$accountId])) {
|
||||
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$accountId]['earned'] = $entry;
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
* @param int $sortFlag
|
||||
@ -212,43 +173,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getCategorySummary(): array
|
||||
{
|
||||
$spent = $this->getSpentCategorySummary();
|
||||
$earned = $this->getEarnedCategorySummary();
|
||||
$return = [];
|
||||
|
||||
/**
|
||||
* @var int $categoryId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($spent as $categoryId => $entry) {
|
||||
if (!isset($return[$categoryId])) {
|
||||
$return[$categoryId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$categoryId]['spent'] = $entry;
|
||||
}
|
||||
unset($entry);
|
||||
|
||||
/**
|
||||
* @var int $categoryId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($earned as $categoryId => $entry) {
|
||||
if (!isset($return[$categoryId])) {
|
||||
$return[$categoryId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$categoryId]['earned'] = $entry;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@ -331,6 +255,45 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $spent
|
||||
* @param array $earned
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getObjectSummary(array $spent, array $earned): array
|
||||
{
|
||||
$return = [];
|
||||
|
||||
/**
|
||||
* @var int $accountId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($spent as $accountId => $entry) {
|
||||
if (!isset($return[$accountId])) {
|
||||
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$accountId]['spent'] = $entry;
|
||||
}
|
||||
unset($entry);
|
||||
|
||||
/**
|
||||
* @var int $accountId
|
||||
* @var string $entry
|
||||
*/
|
||||
foreach ($earned as $accountId => $entry) {
|
||||
if (!isset($return[$accountId])) {
|
||||
$return[$accountId] = ['spent' => 0, 'earned' => 0];
|
||||
}
|
||||
|
||||
$return[$accountId]['earned'] = $entry;
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user