Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some cleaning up.
James Cole7cc47ca0b1e7
diff --git a/app/Helpers/Csv/Specifix/RabobankDescription.php b/app/Helpers/Csv/Specifix/RabobankDescription.phpindex 19304f16db..426688d758 100644--- a/app/Helpers/Csv/Specifix/RabobankDescription.php+++ b/app/Helpers/Csv/Specifix/RabobankDescription.php@@ -29,6 +29,22 @@ class RabobankDescription}+ /**+ * @param array $data+ */+ public function setData($data)+ {+ $this->data = $data;+ }++ /**+ * @param array $row+ */+ public function setRow($row)+ {+ $this->row = $row;+ }+/*** Fixes Rabobank specific thing.*/@@ -46,21 +62,5 @@ class RabobankDescription}- /**- * @param array $data- */- public function setData($data)- {- $this->data = $data;- }-- /**- * @param array $row- */- public function setRow($row)- {- $this->row = $row;- }-}diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 22765419d5..084cd6ed3e 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -65,7 +65,7 @@ class ReportHelper implements ReportHelperInterface/** @var \FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface $singleRepository */$singleRepository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');- $set = $repository->getCategories();+ $set = $repository->getCategories();foreach ($set as $category) {$spent = $singleRepository->balanceInPeriod($category, $start, $end, $accounts);$category->spent = $spent;diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.phpindex 93eda589b0..72944e31f1 100644--- a/app/Http/Controllers/Auth/PasswordController.php+++ b/app/Http/Controllers/Auth/PasswordController.php@@ -78,6 +78,7 @@ class PasswordController extends Controller}abort(404);+return '';}diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex d878afa9aa..4257e86e58 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -4,8 +4,8 @@ use Auth;use Carbon\Carbon;use FireflyIII\Http\Requests\CategoryFormRequest;use FireflyIII\Models\Category;-use FireflyIII\Repositories\Category\CategoryRepositoryInterface;-use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;+use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;+use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;use FireflyIII\Support\CacheProperties;use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;@@ -69,12 +69,12 @@ class CategoryController extends Controller}/**- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param SCRI $repository+ * @param Category $category** @return \Illuminate\Http\RedirectResponse*/- public function destroy(SingleCategoryRepositoryInterface $repository, Category $category)+ public function destroy(SCRI $repository, Category $category){$name = $category->name;@@ -108,12 +108,12 @@ class CategoryController extends Controller}/**- * @param CategoryRepositoryInterface $repository- * @param SingleCategoryRepositoryInterface $singleRepository+ * @param CRI $repository+ * @param SCRI $singleRepository** @return \Illuminate\View\View*/- public function index(CategoryRepositoryInterface $repository, SingleCategoryRepositoryInterface $singleRepository)+ public function index(CRI $repository, SCRI $singleRepository){$categories = $repository->getCategories();@@ -127,11 +127,11 @@ class CategoryController extends Controller}/**- * @param CategoryRepositoryInterface $repository+ * @param CRI $repository** @return \Illuminate\View\View*/- public function noCategory(CategoryRepositoryInterface $repository)+ public function noCategory(CRI $repository){$start = Session::get('start', Carbon::now()->startOfMonth());$end = Session::get('end', Carbon::now()->startOfMonth());@@ -145,14 +145,14 @@ class CategoryController extends Controller}/**- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param SCRI $repository+ * @param Category $category*- * @param $date+ * @param $date** @return \Illuminate\View\View*/- public function showWithDate(SingleCategoryRepositoryInterface $repository, Category $category, $date)+ public function showWithDate(SCRI $repository, Category $category, $date){$carbon = new Carbon($date);$range = Preferences::get('viewRange', '1M')->data;@@ -172,12 +172,12 @@ class CategoryController extends Controller}/**- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param SCRI $repository+ * @param Category $category** @return \Illuminate\View\View*/- public function show(SingleCategoryRepositoryInterface $repository, Category $category)+ public function show(SCRI $repository, Category $category){$hideCategory = true; // used in list.$page = intval(Input::get('page'));@@ -227,12 +227,12 @@ class CategoryController extends Controller}/**- * @param CategoryFormRequest $request- * @param SingleCategoryRepositoryInterface $repository+ * @param CategoryFormRequest $request+ * @param SCRI $repository** @return \Illuminate\Http\RedirectResponse*/- public function store(CategoryFormRequest $request, SingleCategoryRepositoryInterface $repository)+ public function store(CategoryFormRequest $request, SCRI $repository){$categoryData = ['name' => $request->input('name'),@@ -254,13 +254,13 @@ class CategoryController extends Controller/**- * @param CategoryFormRequest $request- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param CategoryFormRequest $request+ * @param SCRI $repository+ * @param Category $category** @return \Illuminate\Http\RedirectResponse*/- public function update(CategoryFormRequest $request, SingleCategoryRepositoryInterface $repository, Category $category)+ public function update(CategoryFormRequest $request, SCRI $repository, Category $category){$categoryData = ['name' => $request->input('name'),diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.phpindex 08f5116adb..6a96bc5bdc 100644--- a/app/Http/Controllers/Chart/CategoryController.php+++ b/app/Http/Controllers/Chart/CategoryController.php@@ -6,8 +6,8 @@ namespace FireflyIII\Http\Controllers\Chart;use Carbon\Carbon;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Models\Category;-use FireflyIII\Repositories\Category\CategoryRepositoryInterface;-use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;+use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;+use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;use FireflyIII\Support\CacheProperties;use Illuminate\Support\Collection;use Navigation;@@ -39,12 +39,12 @@ class CategoryController extends Controller/*** Show an overview for a category for all time, per month/week/year.*- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param SCRI $repository+ * @param Category $category** @return \Symfony\Component\HttpFoundation\Response*/- public function all(SingleCategoryRepositoryInterface $repository, Category $category)+ public function all(SCRI $repository, Category $category){// oldest transaction in category:$start = $repository->getFirstActivityDate($category);@@ -88,11 +88,11 @@ class CategoryController extends Controller/*** Show this month's category overview.*- * @param CategoryRepositoryInterface $repository+ * @param CRI $repository** @return \Symfony\Component\HttpFoundation\Response*/- public function frontpage(CategoryRepositoryInterface $repository)+ public function frontpage(CRI $repository){$start = Session::get('start', Carbon::now()->startOfMonth());@@ -212,12 +212,12 @@ class CategoryController extends Controller}/**- * @param SingleCategoryRepositoryInterface $repository- * @param Category $category+ * @param SCRI $repository+ * @param Category $category** @return \Symfony\Component\HttpFoundation\Response*/- public function currentPeriod(SingleCategoryRepositoryInterface $repository, Category $category)+ public function currentPeriod(SCRI $repository, Category $category){$start = clone Session::get('start', Carbon::now()->startOfMonth());$end = Session::get('end', Carbon::now()->endOfMonth());@@ -252,14 +252,14 @@ class CategoryController extends Controller}/**- * @param SingleCategoryRepositoryInterface $repository+ * @param SCRI $repository* @param Category $category** @param $date** @return \Symfony\Component\HttpFoundation\Response*/- public function specificPeriod(SingleCategoryRepositoryInterface $repository, Category $category, $date)+ public function specificPeriod(SCRI $repository, Category $category, $date){$carbon = new Carbon($date);$range = Preferences::get('viewRange', '1M')->data;@@ -300,7 +300,7 @@ class CategoryController extends Controller* Returns a chart of what has been earned in this period in each category* grouped by month.*- * @param CategoryRepositoryInterface $repository+ * @param CRI $repository* @param $reportType* @param Carbon $start* @param Carbon $end@@ -308,7 +308,7 @@ class CategoryController extends Controller** @return \Illuminate\Http\JsonResponse*/- public function earnedInPeriod(CategoryRepositoryInterface $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)+ public function earnedInPeriod(CRI $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts){$cache = new CacheProperties; // chart properties for cache:$cache->addProperty($start);@@ -367,7 +367,7 @@ class CategoryController extends Controller* Returns a chart of what has been spent in this period in each category* grouped by month.*- * @param CategoryRepositoryInterface $repository+ * @param CRI $repository* @param $reportType* @param Carbon $start* @param Carbon $end@@ -375,7 +375,7 @@ class CategoryController extends Controller** @return \Illuminate\Http\JsonResponse*/- public function spentInPeriod(CategoryRepositoryInterface $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)+ public function spentInPeriod(CRI $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts){$cache = new CacheProperties; // chart properties for cache:$cache->addProperty($start);diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.phpindex a7729bf8e1..6bb10d4743 100644--- a/app/Http/Controllers/JsonController.php+++ b/app/Http/Controllers/JsonController.php@@ -5,7 +5,7 @@ use Carbon\Carbon;use FireflyIII\Helpers\Report\ReportQueryInterface;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Bill\BillRepositoryInterface;-use FireflyIII\Repositories\Category\CategoryRepositoryInterface;+use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use FireflyIII\Support\CacheProperties;@@ -60,7 +60,7 @@ class JsonController extends Controller}/**- * @param BillRepositoryInterface $repository+ * @param BillRepositoryInterface $repository** @return \Symfony\Component\HttpFoundation\Response*/@@ -173,11 +173,11 @@ class JsonController extends Controller/*** Returns a list of categories.*- * @param CategoryRepositoryInterface $repository+ * @param CRI $repository** @return \Illuminate\Http\JsonResponse*/- public function categories(CategoryRepositoryInterface $repository)+ public function categories(CRI $repository){$list = $repository->getCategories();$return = [];diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex 3ede022898..e799779e59 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -66,9 +66,9 @@ class ReportController extends Controllerreturn view('reports.index', compact(- 'months', 'accounts', 'start', 'accountList',- 'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear'- )+ 'months', 'accounts', 'start', 'accountList',+ 'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear'+ ));}diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.phpindex d2c016e356..60609f37ae 100644--- a/app/Models/PiggyBankEvent.php+++ b/app/Models/PiggyBankEvent.php@@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Model;* @property integer $transaction_journal_id* @property \Carbon\Carbon $date* @property float $amount- * @property \FireflyIII\Models\PiggyBank $piggyBank+ * @property \FireflyIII\Models\PiggyBank $piggyBank* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.phpindex 9878738d75..32b9892cd5 100644--- a/app/Repositories/Category/CategoryRepositoryInterface.php+++ b/app/Repositories/Category/CategoryRepositoryInterface.php@@ -3,7 +3,6 @@namespace FireflyIII\Repositories\Category;use Carbon\Carbon;-use FireflyIII\Models\Category;use Illuminate\Support\Collection;/**@@ -27,32 +26,6 @@ interface CategoryRepositoryInterface*/public function earnedForAccounts(Collection $accounts, Carbon $start, Carbon $end);- /**- * Returns a collection of Categories appended with the amount of money that has been spent- * in these categories, based on the $accounts involved, in period X.- * The amount earned in category X in period X is saved in field "spent".- *- * @param $accounts- * @param $start- * @param $end- *- * @return Collection- */- public function spentForAccounts(Collection $accounts, Carbon $start, Carbon $end);-- /**- * Returns a collection of Categories appended with the amount of money that has been spent- * in these categories, based on the $accounts involved, in period X, grouped per month.- * The amount earned in category X in period X is saved in field "spent".- *- * @param $accounts- * @param $start- * @param $end- *- * @return Collection- */- public function spentForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);-/*** Returns a collection of Categories appended with the amount of money that has been earned* in these categories, based on the $accounts involved, in period X, grouped per month.@@ -67,12 +40,7 @@ interface CategoryRepositoryInterfacepublic function earnedForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);/**- * @return Collection- */- public function getCategories();-- /**- * Returns the amount spent without category by accounts in period.+ * Returns the amount earned without category by accounts in period.** @param Collection $accounts* @param Carbon $start@@ -80,18 +48,12 @@ interface CategoryRepositoryInterface** @return string*/- public function spentNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);+ public function earnedNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);/**- * Returns the amount earned without category by accounts in period.- *- * @param Collection $accounts- * @param Carbon $start- * @param Carbon $end- *- * @return string+ * @return Collection*/- public function earnedNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);+ public function getCategories();/*** Corrected for tags.@@ -111,4 +73,41 @@ interface CategoryRepositoryInterface*/public function getWithoutCategory(Carbon $start, Carbon $end);+ /**+ * Returns a collection of Categories appended with the amount of money that has been spent+ * in these categories, based on the $accounts involved, in period X.+ * The amount earned in category X in period X is saved in field "spent".+ *+ * @param $accounts+ * @param $start+ * @param $end+ *+ * @return Collection+ */+ public function spentForAccounts(Collection $accounts, Carbon $start, Carbon $end);++ /**+ * Returns a collection of Categories appended with the amount of money that has been spent+ * in these categories, based on the $accounts involved, in period X, grouped per month.+ * The amount earned in category X in period X is saved in field "spent".+ *+ * @param $accounts+ * @param $start+ * @param $end+ *+ * @return Collection+ */+ public function spentForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);++ /**+ * Returns the amount spent without category by accounts in period.+ *+ * @param Collection $accounts+ * @param Carbon $start+ * @param Carbon $end+ *+ * @return string+ */+ public function spentNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);+}diff --git a/app/Repositories/Category/SingleCategoryRepositoryInterface.php b/app/Repositories/Category/SingleCategoryRepositoryInterface.phpindex c23784e51d..4c5a4ffa2a 100644--- a/app/Repositories/Category/SingleCategoryRepositoryInterface.php+++ b/app/Repositories/Category/SingleCategoryRepositoryInterface.php@@ -98,7 +98,6 @@ interface SingleCategoryRepositoryInterfacepublic function getJournals(Category $category, $page);-/*** @param Category $category* @param int $pagediff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 4b711f18e3..de77081704 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -76,6 +76,7 @@ class Steam* Gets the balance for the given account during the whole range, using this format:** [yyyy-mm-dd] => 123,2+ ** @param Account $account* @param Carbon $start* @param Carbon $end