Skip to content

Firefly III: a personal finances manager

Renamed some methods.

James Colea7501c396fe1
diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php
index c2057ccb7f..5c03c30456 100644
--- a/app/Http/Controllers/HelpController.php
+++ b/app/Http/Controllers/HelpController.php
@@ -32,7 +32,7 @@ class HelpController extends Controller
return Response::json($content);
}
- if ($this->_inCache($route)) {
+ if ($this->inCache($route)) {
$content = [
'text' => Cache::get('help.' . $route . '.text'),
'title' => Cache::get('help.' . $route . '.title'),
@@ -40,7 +40,7 @@ class HelpController extends Controller
return Response::json($content);
}
- $content = $this->_getFromGithub($route);
+ $content = $this->getFromGithub($route);
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
@@ -55,7 +55,7 @@ class HelpController extends Controller
*
* @return bool
*/
- protected function _inCache($route)
+ protected function inCache($route)
{
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
}
@@ -65,7 +65,7 @@ class HelpController extends Controller
*
* @return array
*/
- protected function _getFromGithub($route)
+ protected function getFromGithub($route)
{
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md';
$content = [
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index e9e6daadef..a74e6a0960 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -45,7 +45,7 @@ class ProfileController extends Controller
return Redirect::route('change-password');
}
- $result = $this->_validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
+ $result = $this->validatePassword($request->get('current_password'), $request->get('new_password'), $request->get('new_password_confirmation'));
if (!($result === true)) {
Session::flash('error', $result);
@@ -70,7 +70,7 @@ class ProfileController extends Controller
*
* @return string|bool
*/
- protected function _validatePassword($old, $new1, $new2)
+ protected function validatePassword($old, $new1, $new2)
{
if (strlen($new1) == 0 || strlen($new2) == 0) {
return 'Do fill in a password!';
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 8a4ec3279e..6ea2ec97a8 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -201,8 +201,8 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function store(array $data)
{
- $newAccount = $this->_store($data);
- $this->_storeMetadata($newAccount, $data);
+ $newAccount = $this->storeAccount($data);
+ $this->storeMetadata($newAccount, $data);
// continue with the opposing account:
@@ -214,8 +214,8 @@ class AccountRepository implements AccountRepositoryInterface
'name' => $data['name'] . ' initial balance',
'active' => false,
];
- $opposing = $this->_store($opposingData);
- $this->_storeInitialBalance($newAccount, $opposing, $data);
+ $opposing = $this->storeAccount($opposingData);
+ $this->storeInitialBalance($newAccount, $opposing, $data);
}
@@ -235,7 +235,7 @@ class AccountRepository implements AccountRepositoryInterface
$account->save();
// update meta data:
- $this->_updateMetadata($account, $data);
+ $this->updateMetadata($account, $data);
$openingBalance = $this->openingBalanceTransaction($account);
@@ -244,7 +244,7 @@ class AccountRepository implements AccountRepositoryInterface
// if opening balance, do an update:
if ($openingBalance) {
// update existing opening balance.
- $this->_updateInitialBalance($account, $openingBalance, $data);
+ $this->updateInitialBalance($account, $openingBalance, $data);
} else {
// create new opening balance.
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
@@ -254,8 +254,8 @@ class AccountRepository implements AccountRepositoryInterface
'name' => $data['name'] . ' initial balance',
'active' => false,
];
- $opposing = $this->_store($opposingData);
- $this->_storeInitialBalance($account, $opposing, $data);
+ $opposing = $this->storeAccount($opposingData);
+ $this->storeInitialBalance($account, $opposing, $data);
}
} else {
@@ -274,7 +274,7 @@ class AccountRepository implements AccountRepositoryInterface
*
* @return Account
*/
- protected function _store(array $data)
+ protected function storeAccount(array $data)
{
$type = Config::get('firefly.accountTypeByIdentifier.' . $data['accountType']);
$accountType = AccountType::whereType($type)->first();
@@ -306,7 +306,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param Account $account
* @param array $data
*/
- protected function _storeMetadata(Account $account, array $data)
+ protected function storeMetadata(Account $account, array $data)
{
$metaData = new AccountMeta(
[
@@ -328,7 +328,7 @@ class AccountRepository implements AccountRepositoryInterface
*
* @return TransactionJournal
*/
- protected function _storeInitialBalance(Account $account, Account $opposing, array $data)
+ protected function storeInitialBalance(Account $account, Account $opposing, array $data)
{
$type = $data['openingBalance'] < 0 ? 'Withdrawal' : 'Deposit';
$transactionType = TransactionType::whereType($type)->first();
@@ -397,7 +397,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param Account $account
* @param array $data
*/
- protected function _updateMetadata(Account $account, array $data)
+ protected function updateMetadata(Account $account, array $data)
{
$metaEntries = $account->accountMeta()->get();
$updated = false;
@@ -434,7 +434,7 @@ class AccountRepository implements AccountRepositoryInterface
*
* @return TransactionJournal
*/
- protected function _updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
+ protected function updateInitialBalance(Account $account, TransactionJournal $journal, array $data)
{
$journal->date = $data['openingBalanceDate'];