Skip to content

Firefly III: a personal finances manager

Code cleanup [skip-ci]

James Coled280767407fa
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 78c7371aa5..2e85ab7fd3 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -2,9 +2,15 @@
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
+/**
+ * Class AccountController
+ */
class AccountController extends \BaseController
{
+ /**
+ * @param ARI $accounts
+ */
public function __construct(ARI $accounts)
{
$this->accounts = $accounts;
@@ -82,11 +88,11 @@ class AccountController extends \BaseController
/**
* Display the specified resource.
*
- * @param int $id
+ * @param int $accountId
*
* @return Response
*/
- public function show($id)
+ public function show($accountId)
{
}
@@ -128,6 +134,4 @@ class AccountController extends \BaseController
// }
-
-
}
diff --git a/app/controllers/BaseController.php b/app/controllers/BaseController.php
index 2bee4644a0..bef3da1fe4 100644
--- a/app/controllers/BaseController.php
+++ b/app/controllers/BaseController.php
@@ -1,18 +1,21 @@
<?php
-class BaseController extends Controller {
+/**
+ * Class BaseController
+ */
+class BaseController extends Controller
+{
- /**
- * Setup the layout used by the controller.
- *
- * @return void
- */
- protected function setupLayout()
- {
- if ( ! is_null($this->layout))
- {
- $this->layout = View::make($this->layout);
- }
- }
+ /**
+ * Setup the layout used by the controller.
+ *
+ * @return void
+ */
+ protected function setupLayout()
+ {
+ if (!is_null($this->layout)) {
+ $this->layout = View::make($this->layout);
+ }
+ }
}
diff --git a/app/controllers/ChartController.php b/app/controllers/ChartController.php
index 369fb7c79c..181cf5ff25 100644
--- a/app/controllers/ChartController.php
+++ b/app/controllers/ChartController.php
@@ -4,36 +4,45 @@ use Firefly\Helper\Toolkit\Toolkit as tk;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
+/**
+ * Class ChartController
+ */
class ChartController extends BaseController
{
- protected $accounts;
- protected $journals;
+ protected $_accounts;
+ protected $_journals;
+ /**
+ * @param ARI $accounts
+ * @param TJRI $journals
+ */
public function __construct(ARI $accounts, TJRI $journals)
{
- $this->accounts = $accounts;
- $this->journals = $journals;
+ $this->_accounts = $accounts;
+ $this->_journals = $journals;
}
/**
- * Show home charts.
+ * @param null $accountId
+ *
+ * @return \Illuminate\Http\JsonResponse
*/
- public function homeAccount($id = null)
+ public function homeAccount($accountId = null)
{
list($start, $end) = tk::getDateRange();
$current = clone $start;
$return = [];
$account = null;
- if(!is_null($id)) {
- $account = $this->accounts->find($id);
+ if (!is_null($accountId)) {
+ $account = $this->_accounts->find($accountId);
}
if (is_null($account)) {
- $accounts = $this->accounts->getActiveDefault();
+ $accounts = $this->_accounts->getActiveDefault();
- foreach ($accounts as $index => $account) {
+ foreach ($accounts as $account) {
$return[] = ['name' => $account->name, 'data' => []];
}
while ($current <= $end) {
@@ -69,7 +78,7 @@ class ChartController extends BaseController
'data' => []
];
- $result = $this->journals->homeBudgetChart($start, $end);
+ $result = $this->_journals->homeBudgetChart($start, $end);
foreach ($result as $name => $amount) {
$data['data'][] = [$name, $amount];
@@ -85,7 +94,7 @@ class ChartController extends BaseController
{
list($start, $end) = tk::getDateRange();
- $result = $this->journals->homeCategoryChart($start, $end);
+ $result = $this->_journals->homeCategoryChart($start, $end);
$data = [
'type' => 'pie',
'name' => 'Amount: ',
@@ -111,7 +120,7 @@ class ChartController extends BaseController
'data' => []
];
- $result = $this->journals->homeBeneficiaryChart($start, $end);
+ $result = $this->_journals->homeBeneficiaryChart($start, $end);
foreach ($result as $name => $amount) {
$data['data'][] = [$name, $amount];
diff --git a/app/controllers/ComponentsController.php b/app/controllers/ComponentsController.php
index edd100dcca..215473570f 100644
--- a/app/controllers/ComponentsController.php
+++ b/app/controllers/ComponentsController.php
@@ -1,7 +1,10 @@
<?php
-class ComponentsController extends BaseController {
+/**
+ * Class ComponentsController
+ */
+class ComponentsController extends BaseController
+{
-
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php
index 7a2ed4a2a7..97f31f5106 100644
--- a/app/controllers/HomeController.php
+++ b/app/controllers/HomeController.php
@@ -3,37 +3,47 @@ use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
-
+/**
+ * Class HomeController
+ */
class HomeController extends BaseController
{
- protected $accounts;
- protected $preferences;
- protected $tj;
-
- public function __construct(ARI $accounts, PHI $preferences, TJRI $tj)
+ protected $_accounts;
+ protected $_preferences;
+ protected $_journal;
+
+ /**
+ * @param ARI $accounts
+ * @param PHI $preferences
+ * @param TJRI $journal
+ */
+ public function __construct(ARI $accounts, PHI $preferences, TJRI $journal)
{
- $this->accounts = $accounts;
- $this->preferences = $preferences;
- $this->tj = $tj;
+ $this->_accounts = $accounts;
+ $this->_preferences = $preferences;
+ $this->_journal = $journal;
View::share('menu', 'home');
}
+ /**
+ * @return $this|\Illuminate\View\View
+ */
public function index()
{
// get list setting:
- $pref = $this->preferences->get('frontpageAccounts', []);
+ $pref = $this->_preferences->get('frontpageAccounts', []);
// get the accounts to display on the home screen:
- $count = $this->accounts->count();
+ $count = $this->_accounts->count();
if ($pref->data == []) {
- $list = $this->accounts->getActiveDefault();
+ $list = $this->_accounts->getActiveDefault();
} else {
- $list = $this->accounts->getByIds($pref->data);
+ $list = $this->_accounts->getByIds($pref->data);
}
// get transactions for each account:
foreach ($list as $account) {
- $account->transactionList = $this->tj->getByAccount($account,10);
+ $account->transactionList = $this->_journal->getByAccount($account, 10);
}
diff --git a/app/controllers/JsonController.php b/app/controllers/JsonController.php
index 1d29467199..30ae6608c1 100644
--- a/app/controllers/JsonController.php
+++ b/app/controllers/JsonController.php
@@ -5,19 +5,28 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
use Firefly\Storage\Component\ComponentRepositoryInterface as CRI;
+/**
+ * Class JsonController
+ */
class JsonController extends BaseController
{
- protected $accounts;
- protected $components;
- protected $categories;
- protected $budgets;
+ protected $_accounts;
+ protected $_components;
+ protected $_categories;
+ protected $_budgets;
+ /**
+ * @param ARI $accounts
+ * @param CRI $components
+ * @param Cat $categories
+ * @param Bud $budgets
+ */
public function __construct(ARI $accounts, CRI $components, Cat $categories, Bud $budgets)
{
- $this->components = $components;
- $this->accounts = $accounts;
- $this->categories = $categories;
- $this->budgets = $budgets;
+ $this->_components = $components;
+ $this->_accounts = $accounts;
+ $this->_categories = $categories;
+ $this->_budgets = $budgets;
}
/**
@@ -25,7 +34,7 @@ class JsonController extends BaseController
*/
public function beneficiaries()
{
- $list = $this->accounts->getBeneficiaries();
+ $list = $this->_accounts->getBeneficiaries();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
@@ -40,7 +49,7 @@ class JsonController extends BaseController
*/
public function categories()
{
- $list = $this->categories->get();
+ $list = $this->_categories->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
diff --git a/app/controllers/MigrationController.php b/app/controllers/MigrationController.php
index 1d0f8a293b..dde53ab2e1 100644
--- a/app/controllers/MigrationController.php
+++ b/app/controllers/MigrationController.php
@@ -2,21 +2,33 @@
use Firefly\Helper\Migration\MigrationHelperInterface as MHI;
+/**
+ * Class MigrationController
+ */
class MigrationController extends BaseController
{
- protected $migration;
+ protected $_migration;
+ /**
+ * @param MHI $migration
+ */
public function __construct(MHI $migration)
{
- $this->migration = $migration;
+ $this->_migration = $migration;
View::share('menu', 'home');
}
- public function dev() {
+ /**
+ * Dev method
+ */
+ public function dev()
+ {
$file = Config::get('dev.import');
- if(file_exists($file)) {
+ if (file_exists($file)) {
$user = User::find(1);
+
+ /** @noinspection PhpParamsInspection */
Auth::login($user);
/** @var Firefly\Helper\Migration\MigrationHelperInterface $migration */
$migration = App::make('Firefly\Helper\Migration\MigrationHelperInterface');
@@ -27,11 +39,17 @@ class MigrationController extends BaseController
}
}
+ /**
+ * @return \Illuminate\View\View
+ */
public function index()
{
return View::make('migrate.index');
}
+ /**
+ * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
+ */
public function postIndex()
{
if (Input::hasFile('exportFile')) {
@@ -40,12 +58,12 @@ class MigrationController extends BaseController
$file = Input::file('exportFile');
$path = $file->getRealPath();
- $this->migration->loadFile($path);
+ $this->_migration->loadFile($path);
- if (!$this->migration->validFile()) {
+ if (!$this->_migration->validFile()) {
return View::make('error')->with('message', 'Invalid JSON content.');
}
- $this->migration->migrate();
+ $this->_migration->migrate();
return Redirect::route('index');
} else {
return View::make('error')->with('message', 'No file selected');
diff --git a/app/controllers/PreferencesController.php b/app/controllers/PreferencesController.php
index 7f2773c3d4..b8b62c9e07 100644
--- a/app/controllers/PreferencesController.php
+++ b/app/controllers/PreferencesController.php
@@ -3,43 +3,57 @@
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
+/**
+ * Class PreferencesController
+ */
class PreferencesController extends BaseController
{
- protected $accounts;
- protected $preferences;
+ protected $_accounts;
+ protected $_preferences;
+ /**
+ * @param ARI $accounts
+ * @param PHI $preferences
+ */
public function __construct(ARI $accounts, PHI $preferences)
{
- $this->accounts = $accounts;
- $this->preferences = $preferences;
+ $this->_accounts = $accounts;
+ $this->_preferences = $preferences;
View::share('menu', 'home');
}
+ /**
+ * @return $this|\Illuminate\View\View
+ */
public function index()
{
- $accounts = $this->accounts->getDefault();
+ $accounts = $this->_accounts->getDefault();
- $viewRange = $this->preferences->get('viewRange','1M');
+ $viewRange = $this->_preferences->get('viewRange', '1M');
$viewRangeValue = $viewRange->data;
// pref:
- $frontpage = $this->preferences->get('frontpageAccounts', []);
- return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)->with('viewRange',$viewRangeValue);
+ $frontpage = $this->_preferences->get('frontpageAccounts', []);
+ return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)
+ ->with('viewRange', $viewRangeValue);
}
+ /**
+ * @return \Illuminate\Http\RedirectResponse
+ */
public function postIndex()
{
// frontpage accounts
$frontpageAccounts = [];
- foreach(Input::get('frontpageAccounts') as $id) {
+ foreach (Input::get('frontpageAccounts') as $id) {
$frontpageAccounts[] = intval($id);
}
- $this->preferences->set('frontpageAccounts',$frontpageAccounts);
+ $this->_preferences->set('frontpageAccounts', $frontpageAccounts);
// view range:
- $this->preferences->set('viewRange',Input::get('viewRange'));
+ $this->_preferences->set('viewRange', Input::get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');
diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php
index a3fac53120..76f7784669 100644
--- a/app/controllers/ProfileController.php
+++ b/app/controllers/ProfileController.php
@@ -2,24 +2,41 @@
use Firefly\Storage\User\UserRepositoryInterface as URI;
+/**
+ * Class ProfileController
+ */
class ProfileController extends BaseController
{
- public function __construct(URI $user) {
+ /**
+ * @param URI $user
+ */
+ public function __construct(URI $user)
+ {
$this->user = $user;
View::share('menu', 'home');
}
+ /**
+ * @return \Illuminate\View\View
+ *
+ */
public function index()
{
return View::make('profile.index');
}
+ /**
+ * @return \Illuminate\View\View
+ */
public function changePassword()
{
return View::make('profile.change-password');
}
+ /**
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
+ */
public function postChangePassword()
{
@@ -44,7 +61,8 @@ class ProfileController extends BaseController
}
// update the user with the new password.
- $this->user->updatePassword(Auth::user(),Input::get('new1'));
+ /** @noinspection PhpParamsInspection */
+ $this->user->updatePassword(Auth::user(), Input::get('new1'));
Session::flash('success', 'Password changed!');
return Redirect::route('profile');
diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php
index 48b7c1f78a..2268295a6c 100644
--- a/app/controllers/TransactionController.php
+++ b/app/controllers/TransactionController.php
@@ -6,44 +6,59 @@ use Firefly\Storage\Budget\BudgetRepositoryInterface as Bud;
use Firefly\Storage\Category\CategoryRepositoryInterface as Cat;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
+/**
+ * Class TransactionController
+ */
class TransactionController extends BaseController
{
- protected $accounts;
- protected $budgets;
- protected $categories;
- protected $tj;
-
- public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $tj)
+ protected $_accounts;
+ protected $_budgets;
+ protected $_categories;
+ protected $_journal;
+
+ /**
+ * @param ARI $accounts
+ * @param Bud $budgets
+ * @param Cat $categories
+ * @param TJRI $journal
+ */
+ public function __construct(ARI $accounts, Bud $budgets, Cat $categories, TJRI $journal)
{
- $this->accounts = $accounts;
- $this->budgets = $budgets;
- $this->categories = $categories;
- $this->tj = $tj;
+ $this->_accounts = $accounts;
+ $this->_budgets = $budgets;
+ $this->_categories = $categories;
+ $this->_journal = $journal;
View::share('menu', 'home');
}
+ /**
+ * @return $this|\Illuminate\View\View
+ */
public function createWithdrawal()
{
// get accounts with names and id's.
- $accounts = $this->accounts->getActiveDefaultAsSelectList();
+ $accounts = $this->_accounts->getActiveDefaultAsSelectList();
- $budgets = $this->budgets->getAsSelectList();
+ $budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
return View::make('transactions.withdrawal')->with('accounts', $accounts)->with('budgets', $budgets);
}
+ /**
+ * @return $this|\Illuminate\View\View
+ */
public function createDeposit()
{
// get accounts with names and id's.
- $accounts = $this->accounts->getActiveDefaultAsSelectList();
+ $accounts = $this->_accounts->getActiveDefaultAsSelectList();
- $budgets = $this->budgets->getAsSelectList();
+ $budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
@@ -51,12 +66,15 @@ class TransactionController extends BaseController
}
+ /**
+ * @return $this|\Illuminate\View\View
+ */
public function createTransfer()
{
// get accounts with names and id's.
- $accounts = $this->accounts->getActiveDefaultAsSelectList();
+ $accounts = $this->_accounts->getActiveDefaultAsSelectList();
- $budgets = $this->budgets->getAsSelectList();
+ $budgets = $this->_budgets->getAsSelectList();
$budgets[0] = '(no budget)';
@@ -64,25 +82,28 @@ class TransactionController extends BaseController
}
+ /**
+ * @return \Illuminate\Http\RedirectResponse
+ */
public function postCreateWithdrawal()
{
// create or find beneficiary:
- $beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
+ $beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
// fall back to cash account if empty:
if (is_null($beneficiary)) {
- $beneficiary = $this->accounts->getCashAccount();
+ $beneficiary = $this->_accounts->getCashAccount();
}
// create or find category:
- $category = $this->categories->createOrFind(Input::get('category'));
+ $category = $this->_categories->createOrFind(Input::get('category'));
// find budget:
- $budget = $this->budgets->find(intval(Input::get('budget_id')));
+ $budget = $this->_budgets->find(intval(Input::get('budget_id')));
// find account:
- $account = $this->accounts->find(intval(Input::get('account_id')));
+ $account = $this->_accounts->find(intval(Input::get('account_id')));
// find amount & description:
$description = trim(Input::get('description'));
@@ -92,7 +113,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
- $journal = $this->tj->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
+ $journal = $this->_journal->createSimpleJournal($account, $beneficiary, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.withdrawal')->withInput();
}
@@ -109,21 +130,24 @@ class TransactionController extends BaseController
return Redirect::route('index');
}
+ /**
+ * @return \Illuminate\Http\RedirectResponse
+ */
public function postCreateDeposit()
{
// create or find beneficiary:
- $beneficiary = $this->accounts->createOrFindBeneficiary(Input::get('beneficiary'));
+ $beneficiary = $this->_accounts->createOrFindBeneficiary(Input::get('beneficiary'));
// fall back to cash account if empty:
if (is_null($beneficiary)) {
- $beneficiary = $this->accounts->getCashAccount();
+ $beneficiary = $this->_accounts->getCashAccount();
}
// create or find category:
- $category = $this->categories->createOrFind(Input::get('category'));
+ $category = $this->_categories->createOrFind(Input::get('category'));
// find account:
- $account = $this->accounts->find(intval(Input::get('account_id')));
+ $account = $this->_accounts->find(intval(Input::get('account_id')));
// find amount & description:
$description = trim(Input::get('description'));
@@ -133,7 +157,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
- $journal = $this->tj->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
+ $journal = $this->_journal->createSimpleJournal($beneficiary, $account, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.deposit')->withInput();
}
@@ -146,16 +170,19 @@ class TransactionController extends BaseController
return Redirect::route('index');
}
+ /**
+ * @return \Illuminate\Http\RedirectResponse
+ */
public function postCreateTransfer()
{
// create or find category:
- $category = $this->categories->createOrFind(Input::get('category'));
+ $category = $this->_categories->createOrFind(Input::get('category'));
// find account to:
- $to = $this->accounts->find(intval(Input::get('account_to_id')));
+ $toAccount = $this->_accounts->find(intval(Input::get('account_to_id')));
// find account from
- $from = $this->accounts->find(intval(Input::get('account_from_id')));
+ $from = $this->_accounts->find(intval(Input::get('account_from_id')));
// find amount & description:
$description = trim(Input::get('description'));
@@ -165,7 +192,7 @@ class TransactionController extends BaseController
// create journal
/** @var \TransactionJournal $journal */
try {
- $journal = $this->tj->createSimpleJournal($from, $to, $description, $amount, $date);
+ $journal = $this->_journal->createSimpleJournal($from, $toAccount, $description, $amount, $date);
} catch (\Firefly\Exception\FireflyException $e) {
return Redirect::route('transactions.transfer')->withInput();
}
diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php
index 0e7d7d813c..fa4e24ed36 100644
--- a/app/controllers/UserController.php
+++ b/app/controllers/UserController.php
@@ -3,6 +3,9 @@
use Firefly\Helper\Email\EmailHelperInterface as EHI;
use Firefly\Storage\User\UserRepositoryInterface as URI;
+/**
+ * Class UserController
+ */
class UserController extends BaseController
{
diff --git a/app/lib/Firefly/Exception/FireflyException.php b/app/lib/Firefly/Exception/FireflyException.php
index c76f1affef..89f0ff939c 100644
--- a/app/lib/Firefly/Exception/FireflyException.php
+++ b/app/lib/Firefly/Exception/FireflyException.php
@@ -3,6 +3,7 @@
namespace Firefly\Exception;
-class FireflyException extends \Exception {
+class FireflyException extends \Exception
+{
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Exception/MigrationException.php b/app/lib/Firefly/Exception/MigrationException.php
index 899ad4cfcd..2a31c70474 100644
--- a/app/lib/Firefly/Exception/MigrationException.php
+++ b/app/lib/Firefly/Exception/MigrationException.php
@@ -3,6 +3,7 @@
namespace Firefly\Helper;
-class MigrationException extends \Exception {
+class MigrationException extends \Exception
+{
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Helper/Email/EmailHelperInterface.php b/app/lib/Firefly/Helper/Email/EmailHelperInterface.php
index 9f671f205c..43fe7ee52d 100644
--- a/app/lib/Firefly/Helper/Email/EmailHelperInterface.php
+++ b/app/lib/Firefly/Helper/Email/EmailHelperInterface.php
@@ -2,10 +2,13 @@
namespace Firefly\Helper\Email;
-interface EmailHelperInterface {
+interface EmailHelperInterface
+{
public function sendVerificationMail(\User $user);
+
public function sendPasswordMail(\User $user);
+
public function sendResetVerification(\User $user);
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Helper/Migration/MigrationHelper.php b/app/lib/Firefly/Helper/Migration/MigrationHelper.php
index 0e373da2fe..c3a9e95b59 100644
--- a/app/lib/Firefly/Helper/Migration/MigrationHelper.php
+++ b/app/lib/Firefly/Helper/Migration/MigrationHelper.php
@@ -192,11 +192,11 @@ class MigrationHelper implements MigrationHelperInterface
$journal = $journals->createSimpleJournal($fromAccount, $toAccount, $entry->description, $amount, $date);
// save budgets and categories, on the journal
- if(isset($budgets[$entry->id])) {
+ if (isset($budgets[$entry->id])) {
$budget = $budgets[$entry->id];
$journal->budgets()->save($budget);
}
- if(isset($categories[$entry->id])) {
+ if (isset($categories[$entry->id])) {
$category = $categories[$entry->id];
$journal->categories()->save($category);
}
diff --git a/app/lib/Firefly/Helper/Preferences/PreferencesHelperInterface.php b/app/lib/Firefly/Helper/Preferences/PreferencesHelperInterface.php
index 2c3cd6c6aa..1e80350432 100644
--- a/app/lib/Firefly/Helper/Preferences/PreferencesHelperInterface.php
+++ b/app/lib/Firefly/Helper/Preferences/PreferencesHelperInterface.php
@@ -3,7 +3,8 @@ namespace Firefly\Helper\Preferences;
interface PreferencesHelperInterface
{
- public function set($name,$value);
- public function get($name,$default = null);
+ public function set($name, $value);
+
+ public function get($name, $default = null);
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php b/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
index b158e0c47e..1e36e18a64 100644
--- a/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
+++ b/app/lib/Firefly/Helper/Toolkit/ToolkitInterface.php
@@ -3,7 +3,8 @@
namespace Firefly\Helper\Toolkit;
-interface ToolkitInterface {
+interface ToolkitInterface
+{
public static function getDateRange();
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
index 3ccdfadf47..2de96e0792 100644
--- a/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
+++ b/app/lib/Firefly/Storage/Account/EloquentAccountRepository.php
@@ -156,8 +156,8 @@ class EloquentAccountRepository implements AccountRepositoryInterface
public function getCashAccount()
{
- $type = \AccountType::where('description','Cash account')->first();
- $cash = \Auth::user()->accounts()->where('account_type_id',$type->id)->first();
+ $type = \AccountType::where('description', 'Cash account')->first();
+ $cash = \Auth::user()->accounts()->where('account_type_id', $type->id)->first();
return $cash;
}
diff --git a/app/lib/Firefly/Storage/Budget/BudgetRepositoryInterface.php b/app/lib/Firefly/Storage/Budget/BudgetRepositoryInterface.php
index 89577d8eed..e0896cf387 100644
--- a/app/lib/Firefly/Storage/Budget/BudgetRepositoryInterface.php
+++ b/app/lib/Firefly/Storage/Budget/BudgetRepositoryInterface.php
@@ -6,6 +6,7 @@ namespace Firefly\Storage\Budget;
interface BudgetRepositoryInterface
{
public function getAsSelectList();
+
public function find($id);
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Storage/Component/EloquentComponentRepository.php b/app/lib/Firefly/Storage/Component/EloquentComponentRepository.php
index d59a098e74..631e234260 100644
--- a/app/lib/Firefly/Storage/Component/EloquentComponentRepository.php
+++ b/app/lib/Firefly/Storage/Component/EloquentComponentRepository.php
@@ -17,12 +17,12 @@ class EloquentComponentRepository implements ComponentRepositoryInterface
}
- public function get() {
+ public function get()
+ {
die('no impl');
}
-
public function store($data)
{
if (!isset($data['class'])) {
diff --git a/app/lib/Firefly/Storage/StorageServiceProvider.php b/app/lib/Firefly/Storage/StorageServiceProvider.php
index e286c16e56..ddd66b5861 100644
--- a/app/lib/Firefly/Storage/StorageServiceProvider.php
+++ b/app/lib/Firefly/Storage/StorageServiceProvider.php
@@ -20,7 +20,6 @@ class StorageServiceProvider extends ServiceProvider
);
-
$this->app->bind(
'Firefly\Storage\Account\AccountRepositoryInterface',
'Firefly\Storage\Account\EloquentAccountRepository'
diff --git a/app/lib/Firefly/Storage/Transaction/EloquentTransactionRepository.php b/app/lib/Firefly/Storage/Transaction/EloquentTransactionRepository.php
index 7b0ecf6796..32b485a04f 100644
--- a/app/lib/Firefly/Storage/Transaction/EloquentTransactionRepository.php
+++ b/app/lib/Firefly/Storage/Transaction/EloquentTransactionRepository.php
@@ -3,6 +3,7 @@
namespace Firefly\Storage\Transaction;
-class EloquentTransactionRepository implements TransactionRepositoryInterface {
+class EloquentTransactionRepository implements TransactionRepositoryInterface
+{
}
\ No newline at end of file
diff --git a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php
index 1f9fc79d38..c3380ee3b3 100644
--- a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php
+++ b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php
@@ -38,15 +38,15 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
$amountFrom = $amount * -1;
$amountTo = $amount;
- if(round(floatval($amount),2) == 0.00) {
+ if (round(floatval($amount), 2) == 0.00) {
\Log::error('Transaction will never save: amount = 0');
- \Session::flash('error','The amount should not be empty or zero.');
+ \Session::flash('error', 'The amount should not be empty or zero.');
throw new \Firefly\Exception\FireflyException('Could not figure out transaction type.');
}
// same account:
- if($from->id == $to->id) {
+ if ($from->id == $to->id) {
\Log::error('Accounts cannot be equal');
- \Session::flash('error','Select two different accounts.');
+ \Session::flash('error', 'Select two different accounts.');
throw new \Firefly\Exception\FireflyException('Select two different accounts.');
}
@@ -108,7 +108,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
if (!$journal->save()) {
\Log::error('Cannot create valid journal.');
\Log::error('Errors: ' . print_r($journal->errors()->all(), true));
- \Session::flash('error','Could not create journal: ' . $journal->errors()->first());
+ \Session::flash('error', 'Could not create journal: ' . $journal->errors()->first());
throw new \Firefly\Exception\FireflyException('Cannot create valid journal.');
}
$journal->save();
@@ -173,7 +173,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
}]
)
->after($start)->before($end)
- ->where('completed',1)
+ ->where('completed', 1)
->whereIn('transaction_type_id', $types)
->get(['transaction_journals.*']);
unset($types);
@@ -182,8 +182,9 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
foreach ($journals as $journal) {
// has to be one:
- if(!isset($journal->transactions[0])) {
- throw new FireflyException('Journal #'.$journal->id.' has ' . count($journal->transactions).' transactions!');
+ if (!isset($journal->transactions[0])) {
+ throw new FireflyException('Journal #' . $journal->id . ' has ' . count($journal->transactions)
+ . ' transactions!');
}
$transaction = $journal->transactions[0];
$amount = floatval($transaction->amount);
diff --git a/app/lib/Firefly/Storage/TransactionJournal/TransactionJournalRepositoryInterface.php b/app/lib/Firefly/Storage/TransactionJournal/TransactionJournalRepositoryInterface.php
index d7cc4aa5d5..a19bca137e 100644
--- a/app/lib/Firefly/Storage/TransactionJournal/TransactionJournalRepositoryInterface.php
+++ b/app/lib/Firefly/Storage/TransactionJournal/TransactionJournalRepositoryInterface.php
@@ -12,7 +12,9 @@ interface TransactionJournalRepositoryInterface
public function getByAccount(\Account $account, $count = 25);
public function homeBudgetChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
+
public function homeCategoryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
+
public function homeBeneficiaryChart(\Carbon\Carbon $start, \Carbon\Carbon $end);
public function homeComponentChart(\Carbon\Carbon $start, \Carbon\Carbon $end, $chartType);
diff --git a/app/models/Account.php b/app/models/Account.php
index 319eb1b215..cb4e23754d 100644
--- a/app/models/Account.php
+++ b/app/models/Account.php
@@ -1,6 +1,27 @@
<?php
use LaravelBook\Ardent\Ardent as Ardent;
+/**
+ * Account
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $user_id
+ * @property integer $account_type_id
+ * @property string $name
+ * @property boolean $active
+ * @property-read \AccountType $accountType
+ * @property-read \User $user
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
+ * @method static \Illuminate\Database\Query\Builder|\Account whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereUserId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereAccountTypeId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Account whereActive($value)
+ */
class Account extends Ardent
{
diff --git a/app/models/AccountType.php b/app/models/AccountType.php
index 7ef7db459d..71b1098cdd 100644
--- a/app/models/AccountType.php
+++ b/app/models/AccountType.php
@@ -1,6 +1,19 @@
<?php
+/**
+ * AccountType
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $description
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
+ * @method static \Illuminate\Database\Query\Builder|\AccountType whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\AccountType whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\AccountType whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\AccountType whereDescription($value)
+ */
class AccountType extends Eloquent
{
diff --git a/app/models/Budget.php b/app/models/Budget.php
index de469c125d..e9521a9199 100644
--- a/app/models/Budget.php
+++ b/app/models/Budget.php
@@ -1,5 +1,24 @@
<?php
+/**
+ * Budget
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $name
+ * @property integer $user_id
+ * @property string $class
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
+ * @property-read \User $user
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereUserId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Budget whereClass($value)
+ */
class Budget extends Component {
protected $isSubclass = true;
diff --git a/app/models/Category.php b/app/models/Category.php
index ead0ffac31..403802dd0c 100644
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -1,5 +1,24 @@
<?php
+/**
+ * Category
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $name
+ * @property integer $user_id
+ * @property string $class
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
+ * @property-read \User $user
+ * @method static \Illuminate\Database\Query\Builder|\Category whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Category whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Category whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Category whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Category whereUserId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Category whereClass($value)
+ */
class Category extends Component
{
protected $isSubclass = true;
diff --git a/app/models/Component.php b/app/models/Component.php
index 34a70bc2be..aae42549d2 100644
--- a/app/models/Component.php
+++ b/app/models/Component.php
@@ -1,6 +1,25 @@
<?php
+/**
+ * Component
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $name
+ * @property integer $user_id
+ * @property string $class
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
+ * @property-read \User $user
+ * @method static \Illuminate\Database\Query\Builder|\Component whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Component whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Component whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Component whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Component whereUserId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Component whereClass($value)
+ */
class Component extends Firefly\Database\SingleTableInheritanceEntity
{
diff --git a/app/models/Preference.php b/app/models/Preference.php
index 047355887d..421707b429 100644
--- a/app/models/Preference.php
+++ b/app/models/Preference.php
@@ -3,6 +3,23 @@
use LaravelBook\Ardent\Ardent;
+/**
+ * Preference
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $user_id
+ * @property string $name
+ * @property string $data
+ * @property-read \User $user
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
+ * @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
+ */
class Preference extends Ardent
{
public static $rules
diff --git a/app/models/Transaction.php b/app/models/Transaction.php
index 30b3d86e8b..9eb9071213 100644
--- a/app/models/Transaction.php
+++ b/app/models/Transaction.php
@@ -3,6 +3,29 @@
use LaravelBook\Ardent\Ardent;
+/**
+ * Transaction
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $account_id
+ * @property integer $transaction_journal_id
+ * @property string $description
+ * @property float $amount
+ * @property-read \Account $account
+ * @property-read \TransactionJournal $transactionJournal
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereAccountId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereTransactionJournalId($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereDescription($value)
+ * @method static \Illuminate\Database\Query\Builder|\Transaction whereAmount($value)
+ */
class Transaction extends Ardent
{
public static $rules
diff --git a/app/models/TransactionCurrency.php b/app/models/TransactionCurrency.php
index d3c06ad319..5fd3a3d4aa 100644
--- a/app/models/TransactionCurrency.php
+++ b/app/models/TransactionCurrency.php
@@ -1,6 +1,19 @@
<?php
+/**
+ * TransactionCurrency
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $code
+ * @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
+ * @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCode($value)
+ */
class TransactionCurrency extends Eloquent
{
diff --git a/app/models/TransactionJournal.php b/app/models/TransactionJournal.php
index f5c73ea7ca..d01ed4268a 100644
--- a/app/models/TransactionJournal.php
+++ b/app/models/TransactionJournal.php
@@ -3,6 +3,36 @@
use LaravelBook\Ardent\Ardent;
+/**
+ * TransactionJournal
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property integer $transaction_type_id
+ * @property integer $transaction_currency_id
+ * @property string $description
+ * @property boolean $completed
+ * @property \Carbon\Carbon $date
+ * @property-read \TransactionType $transactionType
+ * @property-read \TransactionCurrency $transactionCurrency
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
+ * @property-read \Illuminate\Database\Eloquent\Collection|\
+ * 'Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|\
+ * 'Category[] $categories
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionTypeId($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionCurrencyId($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDescription($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCompleted($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
+ * @method static \TransactionJournal after($date)
+ * @method static \TransactionJournal before($date)
+ */
class TransactionJournal extends Ardent
{
diff --git a/app/models/TransactionType.php b/app/models/TransactionType.php
index 57ef064b64..dbee6bc992 100644
--- a/app/models/TransactionType.php
+++ b/app/models/TransactionType.php
@@ -1,6 +1,19 @@
<?php
+/**
+ * TransactionType
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $type
+ * @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
+ * @method static \Illuminate\Database\Query\Builder|\TransactionType whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionType whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionType whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\TransactionType whereType($value)
+ */
class TransactionType extends Eloquent {
public function transactionJournals() {
return $this->hasMany('TransactionJournal');
diff --git a/app/models/User.php b/app/models/User.php
index a9856114d6..fa90743c6d 100644
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -7,6 +7,31 @@ use Illuminate\Auth\UserTrait;
use LaravelBook\Ardent\Ardent;
+/**
+ * User
+ *
+ * @property integer $id
+ * @property \Carbon\Carbon $created_at
+ * @property \Carbon\Carbon $updated_at
+ * @property string $email
+ * @property string $password
+ * @property string $reset
+ * @property string $remember_token
+ * @property boolean $migrated
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Preference[] $preferences
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
+ * @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
+ * @method static \Illuminate\Database\Query\Builder|\User whereId($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
+ * @method static \Illuminate\Database\Query\Builder|\User wherePassword($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereReset($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
+ * @method static \Illuminate\Database\Query\Builder|\User whereMigrated($value)
+ */
class User extends Ardent implements UserInterface, RemindableInterface
{