mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Some code cleanup courtesy of PHPStorm.
This commit is contained in:
@@ -66,15 +66,7 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
$this->validate(
|
||||
$request, [
|
||||
$this->loginUsername() => 'required', 'password' => 'required',
|
||||
]
|
||||
);
|
||||
|
||||
// If the class is using the ThrottlesLogins trait, we can automatically throttle
|
||||
// the login attempts for this application. We'll key this by the username and
|
||||
// the IP address of the client making these requests into this application.
|
||||
$this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required',]);
|
||||
$throttles = $this->isUsingThrottlesLoginsTrait();
|
||||
|
||||
if ($throttles && $this->hasTooManyLoginAttempts($request)) {
|
||||
@@ -102,10 +94,6 @@ class AuthController extends Controller
|
||||
$message = trans('firefly.' . $code . '_error', ['email' => $credentials['email']]);
|
||||
}
|
||||
|
||||
|
||||
// If the login attempt was unsuccessful we will increment the number of attempts
|
||||
// to login and redirect the user back to the login form. Of course, when this
|
||||
// user surpasses their maximum number of attempts they will get locked out.
|
||||
if ($throttles) {
|
||||
$this->incrementLoginAttempts($request);
|
||||
}
|
||||
|
@@ -43,6 +43,8 @@ class CategoryController extends Controller
|
||||
* @param SCRI $repository
|
||||
* @param Category $category
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function all(SCRI $repository, Category $category)
|
||||
@@ -67,7 +69,6 @@ class CategoryController extends Controller
|
||||
$spentArray = $repository->spentPerDay($category, $start, $end);
|
||||
$earnedArray = $repository->earnedPerDay($category, $start, $end);
|
||||
|
||||
|
||||
while ($start <= $end) {
|
||||
$currentEnd = Navigation::endOfPeriod($start, $range);
|
||||
|
||||
@@ -161,23 +162,8 @@ class CategoryController extends Controller
|
||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/**
|
||||
* category
|
||||
* year:
|
||||
* spent: x
|
||||
* earned: x
|
||||
* year
|
||||
* spent: x
|
||||
* earned: x
|
||||
*/
|
||||
$entries = new Collection;
|
||||
// go by category, not by year.
|
||||
|
||||
// given a set of categories and accounts, it should not be difficult to get
|
||||
// the exact array of data we need.
|
||||
|
||||
// then get the data for "no category".
|
||||
$set = $repository->listMultiYear($categories, $accounts, $start, $end);
|
||||
$set = $repository->listMultiYear($categories, $accounts, $start, $end);
|
||||
|
||||
/** @var Category $category */
|
||||
foreach ($categories as $category) {
|
||||
|
@@ -79,8 +79,8 @@ class CsvController extends Controller
|
||||
if ($this->data->hasHeaders()) {
|
||||
$headers = $firstRow;
|
||||
}
|
||||
|
||||
foreach (Config::get('csv.roles') as $name => $role) {
|
||||
$keys = array_keys(Config::get('csv.roles'));
|
||||
foreach ($keys as $name) {
|
||||
$availableRoles[$name] = trans('firefly.csv_column_' . $name);//$role['name'];
|
||||
}
|
||||
ksort($availableRoles);
|
||||
@@ -105,7 +105,7 @@ class CsvController extends Controller
|
||||
}
|
||||
$data = [
|
||||
'date-format' => Session::get('csv-date-format'),
|
||||
'has-headers' => Session::get('csv-has-headers')
|
||||
'has-headers' => Session::get('csv-has-headers'),
|
||||
];
|
||||
if (Session::has('csv-map')) {
|
||||
$data['map'] = Session::get('csv-map');
|
||||
@@ -174,7 +174,7 @@ class CsvController extends Controller
|
||||
$delimiters = [
|
||||
',' => trans('form.csv_comma'),
|
||||
';' => trans('form.csv_semicolon'),
|
||||
'tab' => trans('form.csv_tab')
|
||||
'tab' => trans('form.csv_tab'),
|
||||
];
|
||||
|
||||
// get a list of asset accounts:
|
||||
|
@@ -134,28 +134,20 @@ class RuleController extends Controller
|
||||
{
|
||||
// has old input?
|
||||
if (Input::old()) {
|
||||
// process old triggers.
|
||||
$oldTriggers = $this->getPreviousTriggers();
|
||||
$triggerCount = count($oldTriggers);
|
||||
|
||||
// process old actions
|
||||
$oldActions = $this->getPreviousActions();
|
||||
$actionCount = count($oldActions);
|
||||
$oldActions = $this->getPreviousActions();
|
||||
$actionCount = count($oldActions);
|
||||
} else {
|
||||
// get current triggers
|
||||
$oldTriggers = $this->getCurrentTriggers($rule);
|
||||
$triggerCount = count($oldTriggers);
|
||||
|
||||
// get current actions
|
||||
$oldActions = $this->getCurrentActions($rule);
|
||||
$actionCount = count($oldActions);
|
||||
$oldActions = $this->getCurrentActions($rule);
|
||||
$actionCount = count($oldActions);
|
||||
}
|
||||
|
||||
// get rule trigger for update / store-journal:
|
||||
$primaryTrigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first()->trigger_value;
|
||||
|
||||
|
||||
$subTitle = trans('firefly.edit_rule', ['title' => $rule->title]);
|
||||
$subTitle = trans('firefly.edit_rule', ['title' => $rule->title]);
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
if (Session::get('rules.rule.edit.fromUpdate') !== true) {
|
||||
|
@@ -46,7 +46,7 @@ class RuleGroupController extends Controller
|
||||
Session::flash('gaEventCategory', 'rules');
|
||||
Session::flash('gaEventAction', 'create-rule-group');
|
||||
|
||||
return view('rules.rule-group.create', compact('subTitleIcon', 'what', 'subTitle'));
|
||||
return view('rules.rule-group.create', compact('subTitleIcon', 'subTitle'));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -58,9 +58,7 @@ class TransactionController extends Controller
|
||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
||||
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
|
||||
$budgets[0] = trans('form.noBudget');
|
||||
|
||||
// piggy bank list:
|
||||
$piggyBanks = Auth::user()->piggyBanks()->orderBy('order', 'ASC')->get();
|
||||
$piggyBanks = Auth::user()->piggyBanks()->orderBy('order', 'ASC')->get();
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($piggyBanks as $piggy) {
|
||||
$piggy->name = $piggy->name . ' (' . Amount::format($piggy->currentRelevantRep()->currentamount, false) . ')';
|
||||
@@ -161,7 +159,7 @@ class TransactionController extends Controller
|
||||
'date' => $journal->date->format('Y-m-d'),
|
||||
'category' => '',
|
||||
'budget_id' => 0,
|
||||
'piggy_bank_id' => 0
|
||||
'piggy_bank_id' => 0,
|
||||
];
|
||||
// get tags:
|
||||
$preFilled['tags'] = join(',', $journal->tags->pluck('tag')->toArray());
|
||||
|
Reference in New Issue
Block a user