mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Some cleanup.
This commit is contained in:
@@ -13,6 +13,8 @@ class Account implements AccountInterface
|
||||
{
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function index(Collection $accounts)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ interface AccountInterface
|
||||
public function index(Collection $accounts);
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param \Account $account
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
@@ -52,15 +52,13 @@ class Budget implements BudgetInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
* @param $repetitionId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function organizeRepetition(\Budget $budget, $repetitionId)
|
||||
public function organizeRepetition($repetitionId)
|
||||
{
|
||||
$result = [];
|
||||
$inRepetition = [];
|
||||
$repetition = \LimitRepetition::with('limit', 'limit.budget')->leftJoin(
|
||||
'limits', 'limit_repetitions.limit_id', '=', 'limits.id'
|
||||
)->leftJoin('components', 'limits.component_id', '=', 'components.id')->where(
|
||||
|
||||
@@ -18,6 +18,12 @@ interface BudgetInterface
|
||||
*/
|
||||
public function organizeByDate(Collection $budgets);
|
||||
|
||||
/**
|
||||
* @param $repetitionId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function organizeRepetition($repetitionId);
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
@@ -26,14 +32,6 @@ interface BudgetInterface
|
||||
*/
|
||||
public function organizeRepetitions(\Budget $budget);
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
* @param $repetitionId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function organizeRepetition(\Budget $budget, $repetitionId);
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
*
|
||||
|
||||
@@ -5,8 +5,20 @@ namespace Firefly\Helper\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class Category
|
||||
*
|
||||
* @package Firefly\Helper\Controllers
|
||||
*/
|
||||
class Category implements CategoryInterface
|
||||
{
|
||||
/**
|
||||
* @param \Category $category
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function journalsInRange(\Category $category, Carbon $start, Carbon $end)
|
||||
{
|
||||
return $category->transactionjournals()->with(
|
||||
|
||||
@@ -5,9 +5,21 @@ namespace Firefly\Helper\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Interface CategoryInterface
|
||||
*
|
||||
* @package Firefly\Helper\Controllers
|
||||
*/
|
||||
interface CategoryInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param \Category $category
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function journalsInRange(\Category $category, Carbon $start, Carbon $end);
|
||||
}
|
||||
@@ -5,9 +5,21 @@ namespace Firefly\Helper\Controllers;
|
||||
use Carbon\Carbon;
|
||||
use Firefly\Exception\FireflyException;
|
||||
|
||||
/**
|
||||
* Class Chart
|
||||
*
|
||||
* @package Firefly\Helper\Controllers
|
||||
*/
|
||||
class Chart implements ChartInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function account(\Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
$current = clone $start;
|
||||
@@ -30,6 +42,12 @@ class Chart implements ChartInterface
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function accountDailySummary(\Account $account, Carbon $date)
|
||||
{
|
||||
$result = [
|
||||
@@ -80,6 +98,8 @@ class Chart implements ChartInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function budgets(Carbon $start)
|
||||
@@ -164,6 +184,13 @@ class Chart implements ChartInterface
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws \Firefly\Exception\FireflyException
|
||||
*/
|
||||
public function categories(Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -211,6 +238,15 @@ class Chart implements ChartInterface
|
||||
return $chartData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Category $category
|
||||
* @param $range
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
* @throws \Firefly\Exception\FireflyException
|
||||
*/
|
||||
public function categoryShowChart(\Category $category, $range, Carbon $start, Carbon $end)
|
||||
{
|
||||
$data = ['name' => $category->name . ' per ' . $range, 'data' => []];
|
||||
@@ -278,7 +314,7 @@ class Chart implements ChartInterface
|
||||
$title = '';
|
||||
switch ($range) {
|
||||
default:
|
||||
throw new \Firefly\Exception\FireflyException('No date formats for frequency "' . $range . '"!');
|
||||
throw new FireflyException('No date formats for frequency "' . $range . '"!');
|
||||
break;
|
||||
case '1D':
|
||||
$title = $beginning->format('j F Y');
|
||||
|
||||
@@ -5,16 +5,53 @@ namespace Firefly\Helper\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Interface ChartInterface
|
||||
*
|
||||
* @package Firefly\Helper\Controllers
|
||||
*/
|
||||
interface ChartInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function account(\Account $account, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function categories(Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function budgets(Carbon $start);
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function accountDailySummary(\Account $account, Carbon $date);
|
||||
|
||||
/**
|
||||
* @param \Category $category
|
||||
* @param $range
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function categoryShowChart(\Category $category, $range, Carbon $start, Carbon $end);
|
||||
}
|
||||
Reference in New Issue
Block a user