From 5eb0e18cae9260317cdd5502e4259ffc237624d2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 1 Jan 2016 21:15:03 +0100 Subject: [PATCH] Cleaning up --- app/Helpers/Collection/BalanceLine.php | 63 +++++++++---------- app/Helpers/Report/ReportQuery.php | 2 - app/Helpers/Report/ReportQueryInterface.php | 20 +++--- .../Budget/BudgetRepositoryInterface.php | 6 +- resources/twig/emails/registered-html.twig | 1 + 5 files changed, 43 insertions(+), 49 deletions(-) diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php index ff0d17fc3b..0800010c42 100644 --- a/app/Helpers/Collection/BalanceLine.php +++ b/app/Helpers/Collection/BalanceLine.php @@ -3,7 +3,6 @@ namespace FireflyIII\Helpers\Collection; use FireflyIII\Models\Budget as BudgetModel; -use FireflyIII\Models\LimitRepetition; use Illuminate\Support\Collection; /** @@ -45,24 +44,19 @@ class BalanceLine } /** - * @return string + * @return Collection */ - public function getTitle() + public function getBalanceEntries() { - if ($this->getBudget() instanceof BudgetModel) { - return $this->getBudget()->name; - } - if ($this->getRole() == self::ROLE_DEFAULTROLE) { - return trans('firefly.noBudget'); - } - if ($this->getRole() == self::ROLE_TAGROLE) { - return trans('firefly.coveredWithTags'); - } - if ($this->getRole() == self::ROLE_DIFFROLE) { - return trans('firefly.leftUnbalanced'); - } + return $this->balanceEntries; + } - return ''; + /** + * @param Collection $balanceEntries + */ + public function setBalanceEntries($balanceEntries) + { + $this->balanceEntries = $balanceEntries; } /** @@ -97,6 +91,27 @@ class BalanceLine $this->role = $role; } + /** + * @return string + */ + public function getTitle() + { + if ($this->getBudget() instanceof BudgetModel) { + return $this->getBudget()->name; + } + if ($this->getRole() == self::ROLE_DEFAULTROLE) { + return trans('firefly.noBudget'); + } + if ($this->getRole() == self::ROLE_TAGROLE) { + return trans('firefly.coveredWithTags'); + } + if ($this->getRole() == self::ROLE_DIFFROLE) { + return trans('firefly.leftUnbalanced'); + } + + return ''; + } + /** * If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine * should have a "spent" value, which is the amount of money that has been spent @@ -115,20 +130,4 @@ class BalanceLine return $start; } - - /** - * @return Collection - */ - public function getBalanceEntries() - { - return $this->balanceEntries; - } - - /** - * @param Collection $balanceEntries - */ - public function setBalanceEntries($balanceEntries) - { - $this->balanceEntries = $balanceEntries; - } } diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index 208c4e8ff2..24fa89dc7d 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -5,8 +5,6 @@ namespace FireflyIII\Helpers\Report; use Auth; use Carbon\Carbon; use DB; -use FireflyIII\Models\Account; -use FireflyIII\Models\Budget; use FireflyIII\Models\TransactionType; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Collection; diff --git a/app/Helpers/Report/ReportQueryInterface.php b/app/Helpers/Report/ReportQueryInterface.php index 8bb0c43762..0656ec2115 100644 --- a/app/Helpers/Report/ReportQueryInterface.php +++ b/app/Helpers/Report/ReportQueryInterface.php @@ -3,8 +3,6 @@ namespace FireflyIII\Helpers\Report; use Carbon\Carbon; -use FireflyIII\Models\Account; -use FireflyIII\Models\Budget; use Illuminate\Support\Collection; /** @@ -16,16 +14,16 @@ interface ReportQueryInterface { /** - * This method returns all the "in" transaction journals for the given account and given period. The amount - * is stored in "journalAmount". + * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) + * grouped by month like so: "2015-01" => '123.45' * * @param Collection $accounts * @param Carbon $start * @param Carbon $end * - * @return Collection + * @return array */ - public function income(Collection $accounts, Carbon $start, Carbon $end); + public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end); /** * This method returns all the "out" transaction journals for the given account and given period. The amount @@ -40,16 +38,16 @@ interface ReportQueryInterface public function expense(Collection $accounts, Carbon $start, Carbon $end); /** - * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) - * grouped by month like so: "2015-01" => '123.45' + * This method returns all the "in" transaction journals for the given account and given period. The amount + * is stored in "journalAmount". * * @param Collection $accounts * @param Carbon $start * @param Carbon $end * - * @return array + * @return Collection */ - public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end); + public function income(Collection $accounts, Carbon $start, Carbon $end); /** * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) @@ -61,7 +59,7 @@ interface ReportQueryInterface * * @return array */ - public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end); + public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end); } diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 0411da4d77..c9c9d8bc40 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -17,8 +17,6 @@ interface BudgetRepositoryInterface { - - /** * @return void */ @@ -97,8 +95,8 @@ interface BudgetRepositoryInterface * from the given users accounts.. * * @param Collection $accounts - * @param Carbon $start - * @param Carbon $end + * @param Carbon $start + * @param Carbon $end * * @return array */ diff --git a/resources/twig/emails/registered-html.twig b/resources/twig/emails/registered-html.twig index d05f6901d0..532322e75a 100644 --- a/resources/twig/emails/registered-html.twig +++ b/resources/twig/emails/registered-html.twig @@ -61,6 +61,7 @@ +