Fixed parameter order [skip ci]

This commit is contained in:
James Cole 2015-05-03 12:54:39 +02:00
parent 48168b1ef0
commit bb84f7a434
12 changed files with 175 additions and 129 deletions

View File

@ -67,11 +67,12 @@ class AccountController extends Controller
}
/**
* @param Account $account
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Account $account, AccountRepositoryInterface $repository)
public function destroy(AccountRepositoryInterface $repository, Account $account)
{
$type = $account->accountType->type;
@ -86,12 +87,12 @@ class AccountController extends Controller
}
/**
* @param Account $account
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function edit(Account $account, AccountRepositoryInterface $repository)
public function edit(AccountRepositoryInterface $repository,Account $account)
{
$what = Config::get('firefly.shortNamesByFullName')[$account->accountType->type];
@ -129,12 +130,12 @@ class AccountController extends Controller
}
/**
* @param $what
* @param AccountRepositoryInterface $repository
* @param $what
*
* @return View
*/
public function index($what, AccountRepositoryInterface $repository)
public function index(AccountRepositoryInterface $repository, $what)
{
$subTitle = Config::get('firefly.subTitlesByIdentifier.' . $what);
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
@ -158,12 +159,12 @@ class AccountController extends Controller
}
/**
* @param Account $account
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function show(Account $account, AccountRepositoryInterface $repository)
public function show(AccountRepositoryInterface $repository, Account $account)
{
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
@ -214,13 +215,13 @@ class AccountController extends Controller
}
/**
* @param Account $account
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return \Illuminate\Http\RedirectResponse
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(Account $account, AccountFormRequest $request, AccountRepositoryInterface $repository)
public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
{
$accountData = [

View File

@ -35,11 +35,12 @@ class BillController extends Controller
}
/**
* @param Bill $bill
* @param AccountRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
*/
public function add(Bill $bill, AccountRepositoryInterface $repository)
public function add(AccountRepositoryInterface $repository, Bill $bill)
{
$matches = explode(',', $bill->match);
$description = [];
@ -107,11 +108,12 @@ class BillController extends Controller
}
/**
* @param Bill $bill
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Bill $bill, BillRepositoryInterface $repository)
public function destroy(BillRepositoryInterface $repository, Bill $bill)
{
$repository->destroy($bill);
@ -158,11 +160,12 @@ class BillController extends Controller
}
/**
* @param Bill $bill
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return mixed
* @return \Illuminate\Http\RedirectResponse
*/
public function rescan(Bill $bill, BillRepositoryInterface $repository)
public function rescan(BillRepositoryInterface $repository, Bill $bill)
{
if (intval($bill->active) == 0) {
Session::flash('warning', 'Inactive bills cannot be scanned.');
@ -183,11 +186,12 @@ class BillController extends Controller
}
/**
* @param Bill $bill
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return mixed
*/
public function show(Bill $bill, BillRepositoryInterface $repository)
public function show(BillRepositoryInterface $repository, Bill $bill)
{
$journals = $repository->getJournals($bill);
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
@ -197,7 +201,10 @@ class BillController extends Controller
}
/**
* @return $this
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
{
@ -218,11 +225,13 @@ class BillController extends Controller
}
/**
* @param Bill $bill
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return $this
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(Bill $bill, BillFormRequest $request, BillRepositoryInterface $repository)
public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
{
$billData = $request->getBillData();
$bill = $repository->update($bill, $billData);

View File

@ -36,11 +36,12 @@ class BudgetController extends Controller
}
/**
* @param Budget $budget
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function amount(Budget $budget, BudgetRepositoryInterface $repository)
public function amount(BudgetRepositoryInterface $repository, Budget $budget)
{
$amount = intval(Input::get('amount'));
$date = Session::get('start', Carbon::now()->startOfMonth());
@ -80,7 +81,8 @@ class BudgetController extends Controller
}
/**
* @param Budget $budget
* @param Budget $budget
* @param BudgetRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
@ -116,7 +118,9 @@ class BudgetController extends Controller
}
/**
* @return mixed
* @param BudgetRepositoryInterface $repository
*
* @return View
*/
public function index(BudgetRepositoryInterface $repository)
{
@ -150,7 +154,9 @@ class BudgetController extends Controller
}
/**
* @return \Illuminate\View\View
* @param BudgetRepositoryInterface $repository
*
* @return View
*/
public function noBudget(BudgetRepositoryInterface $repository)
{
@ -163,7 +169,7 @@ class BudgetController extends Controller
}
/**
* @return mixed
* @return \Illuminate\Http\RedirectResponse
*/
public function postUpdateIncome()
{
@ -175,13 +181,13 @@ class BudgetController extends Controller
}
/**
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return \Illuminate\View\View
* @return View
*/
public function show(Budget $budget, LimitRepetition $repetition = null, BudgetRepositoryInterface $repository)
public function show(BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition = null)
{
if (!is_null($repetition->id) && $repetition->budgetLimit->budget->id != $budget->id) {
return view('error')->with('message', 'Invalid selection.');
@ -224,13 +230,13 @@ class BudgetController extends Controller
}
/**
* @param Budget $budget
* @param BudgetFormRequest $request
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return \Illuminate\Http\RedirectResponse
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(Budget $budget, BudgetFormRequest $request, BudgetRepositoryInterface $repository)
public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
{
$budgetData = [
'name' => $request->input('name'),
@ -254,14 +260,14 @@ class BudgetController extends Controller
}
/**
* @return $this
* @return View
*/
public function updateIncome()
{
$date = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
$budgetAmount = Preferences::get('budgetIncomeTotal' . $date, 1000);
$amount = Preferences::get('budgetIncomeTotal' . $date, 1000);
return view('budgets.income')->with('amount', $budgetAmount);
return view('budgets.income',compact('amount'));
}
}

View File

@ -61,11 +61,12 @@ class CategoryController extends Controller
}
/**
* @param Category $category
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Category $category, CategoryRepositoryInterface $repository)
public function destroy(CategoryRepositoryInterface $repository, Category $category)
{
$name = $category->name;
@ -126,11 +127,12 @@ class CategoryController extends Controller
}
/**
* @param Category $category
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return $this
* @return View
*/
public function show(Category $category, CategoryRepositoryInterface $repository)
public function show(CategoryRepositoryInterface $repository, Category $category)
{
$hideCategory = true; // used in list.
$page = intval(Input::get('page'));
@ -169,13 +171,13 @@ class CategoryController extends Controller
/**
* @param Category $category
* @param CategoryFormRequest $request
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(Category $category, CategoryFormRequest $request, CategoryRepositoryInterface $repository)
public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
{
$categoryData = [
'name' => $request->input('name'),

View File

@ -68,11 +68,12 @@ class CurrencyController extends Controller
}
/**
* @param TransactionCurrency $currency
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
* @return \Illuminate\Http\RedirectResponse|View
*/
public function delete(TransactionCurrency $currency, CurrencyRepositoryInterface $repository)
public function delete(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if ($repository->countJournals($currency) > 0) {
@ -89,11 +90,13 @@ class CurrencyController extends Controller
}
/**
* @param TransactionCurrency $currency
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function destroy(TransactionCurrency $currency, CurrencyRepositoryInterface $repository)
public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.');
@ -166,11 +169,13 @@ class CurrencyController extends Controller
}
/**
* @param TransactionCurrency $currency
* @param CurrencyFormRequest $request
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return $this|\Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function update(TransactionCurrency $currency, CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
public function update(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
$data = $request->getCurrencyData();
$currency = $repository->update($currency, $data);

View File

@ -35,12 +35,12 @@ class GoogleChartController extends Controller
/**
* @param GChart $chart
* @param Account $account
* @param string $view
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function accountBalanceChart(Account $account, GChart $chart)
public function accountBalanceChart(GChart $chart, Account $account)
{
$chart->addColumn('Day of month', 'date');
$chart->addColumn('Balance for ' . $account->name, 'number');
@ -64,7 +64,8 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param GChart $chart
* @param AccountRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
@ -104,11 +105,13 @@ class GoogleChartController extends Controller
}
/**
* @param int $year
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param $year
*
* @return $this|\Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function allBudgetsAndSpending($year, GChart $chart, BudgetRepositoryInterface $repository)
public function allBudgetsAndSpending(GChart $chart, BudgetRepositoryInterface $repository, $year)
{
$budgets = $repository->getBudgets();
$chart->addColumn('Month', 'date');
@ -137,7 +140,8 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
@ -183,7 +187,8 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
@ -210,12 +215,13 @@ class GoogleChartController extends Controller
}
/**
* @param Bill $bill
* @param GChart $chart
* @param GChart $chart
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function billOverview(Bill $bill, GChart $chart, BillRepositoryInterface $repository)
public function billOverview(GChart $chart, BillRepositoryInterface $repository, Bill $bill)
{
$chart->addColumn('Date', 'date');
@ -319,13 +325,14 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function budgetLimitSpending(Budget $budget, LimitRepetition $repetition, GChart $chart, BudgetRepositoryInterface $repository)
public function budgetLimitSpending(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition)
{
$start = clone $repetition->startdate;
$end = $repetition->enddate;
@ -352,10 +359,10 @@ class GoogleChartController extends Controller
}
/**
* @param Budget $budget
* @param int $year
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param int $year
*
* @return \Symfony\Component\HttpFoundation\Response
*/
@ -389,12 +396,13 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @param Category $category
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function categoryOverviewChart(Category $category, GChart $chart, CategoryRepositoryInterface $repository)
public function categoryOverviewChart(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
// oldest transaction in category:
$start = $repository->getFirstActivityDate($category);
@ -425,12 +433,13 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @param Category $category
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function categoryPeriodChart(Category $category, GChart $chart, CategoryRepositoryInterface $repository)
public function categoryPeriodChart(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
$start = clone Session::get('start', Carbon::now()->startOfMonth());
$chart->addColumn('Period', 'date');
@ -452,11 +461,13 @@ class GoogleChartController extends Controller
/**
* @param PiggyBank $piggyBank
* @param GChart $chart
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function piggyBankHistory(PiggyBank $piggyBank, GChart $chart, PiggyBankRepositoryInterface $repository)
public function piggyBankHistory(GChart $chart, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$chart->addColumn('Date', 'date');
$chart->addColumn('Balance', 'number');
@ -477,12 +488,13 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param ReportQueryInterface $query
* @param $year
*
* @param $year
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInExp($year, GChart $chart, ReportQueryInterface $query)
public function yearInExp(GChart $chart, ReportQueryInterface $query,$year)
{
$start = new Carbon('01-01-' . $year);
$chart->addColumn('Month', 'date');
@ -515,12 +527,13 @@ class GoogleChartController extends Controller
}
/**
* @param GChart $chart
* @param ReportQueryInterface $query
* @param $year
*
* @param $year
*
* @return \Illuminate\Http\JsonResponse
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInExpSum($year, GChart $chart, ReportQueryInterface $query)
public function yearInExpSum(GChart $chart, ReportQueryInterface $query, $year)
{
$start = new Carbon('01-01-' . $year);
$chart->addColumn('Summary', 'string');

View File

@ -17,7 +17,7 @@ class HelpController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function show($route, HelpInterface $help)
public function show(HelpInterface $help, $route)
{
$content = [
'text' => '<p>There is no help for this route!</p>',

View File

@ -236,11 +236,12 @@ class JsonController extends Controller
}
/**
* @param $what
* @param JournalRepositoryInterface $repository
* @param $what
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function transactionJournals($what, JournalRepositoryInterface $repository)
public function transactionJournals(JournalRepositoryInterface $repository, $what)
{
$descriptions = [];
$dbType = $repository->getTransactionType($what);

View File

@ -44,7 +44,7 @@ class PiggyBankController extends Controller
*
* @return $this
*/
public function add(PiggyBank $piggyBank, AccountRepositoryInterface $repository)
public function add(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{
$leftOnAccount = $repository->leftOnAccount($piggyBank->account);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
@ -92,11 +92,12 @@ class PiggyBankController extends Controller
}
/**
* @param PiggyBank $piggyBank
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
public function destroy(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
@ -107,13 +108,12 @@ class PiggyBankController extends Controller
}
/**
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
* @param AccountRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @param PiggyBank $piggyBank
*
* @return $this
* @return View
*/
public function edit(PiggyBank $piggyBank, AccountRepositoryInterface $repository)
public function edit(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{
$periods = Config::get('firefly.piggy_bank_periods');
@ -149,7 +149,10 @@ class PiggyBankController extends Controller
}
/**
* @return $this
* @param AccountRepositoryInterface $repository
* @param PiggyBankRepositoryInterface $piggyRepository
*
* @return View
*/
public function index(AccountRepositoryInterface $repository, PiggyBankRepositoryInterface $piggyRepository)
{
@ -187,7 +190,7 @@ class PiggyBankController extends Controller
}
/**
* Allow user to order piggy banks.
* @param PiggyBankRepositoryInterface $repository
*/
public function order(PiggyBankRepositoryInterface $repository)
{
@ -204,13 +207,13 @@ class PiggyBankController extends Controller
}
/**
* POST add money to piggy bank
*
* @param PiggyBank $piggyBank
* @param PiggyBankRepositoryInterface $repository
* @param AccountRepositoryInterface $accounts
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postAdd(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository, AccountRepositoryInterface $accounts)
public function postAdd(PiggyBankRepositoryInterface $repository, AccountRepositoryInterface $accounts, PiggyBank $piggyBank)
{
$amount = round(floatval(Input::get('amount')), 2);
$leftOnAccount = $accounts->leftOnAccount($piggyBank->account);
@ -240,11 +243,12 @@ class PiggyBankController extends Controller
}
/**
* @param PiggyBank $piggyBank
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postRemove(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = floatval(Input::get('amount'));
@ -279,11 +283,12 @@ class PiggyBankController extends Controller
}
/**
* @param PiggyBank $piggyBank
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return $this
* @return View
*/
public function show(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$events = $repository->getEvents($piggyBank);
@ -338,7 +343,7 @@ class PiggyBankController extends Controller
*
* @return $this
*/
public function update(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request)
public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank)
{
$piggyBankData = [
'name' => $request->get('name'),

View File

@ -87,11 +87,12 @@ class TagController extends Controller
}
/**
* @param Tag $tag
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Tag $tag, TagRepositoryInterface $repository)
public function destroy(TagRepositoryInterface $repository,Tag $tag)
{
$tagName = $tag->tag;
@ -273,9 +274,13 @@ class TagController extends Controller
}
/**
* @param Tag $tag
* @param TagFormRequest $request
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(Tag $tag, TagFormRequest $request, TagRepositoryInterface $repository)
public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
{
if (Input::get('setTag') == 'true') {
$latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null;

View File

@ -116,7 +116,7 @@ class TransactionController extends Controller
*
* @return $this
*/
public function edit(TransactionJournal $journal, JournalRepositoryInterface $repository)
public function edit(TransactionJournal $journal)
{
$what = strtolower($journal->transactiontype->type);
$accounts = ExpandedForm::makeSelectList(
@ -310,13 +310,13 @@ class TransactionController extends Controller
}
/**
* @param TransactionJournal $journal
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @SuppressWarnings("CyclomaticComplexity") // It's exactly 5. So I don't mind.
*
* @return $this
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(TransactionJournal $journal, JournalFormRequest $request, JournalRepositoryInterface $repository)
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
$journalData = $request->getJournalData();

View File

@ -14,7 +14,6 @@ class ReportControllerTest extends TestCase
public function setUp()
{
parent::setUp();
FactoryMuffin::create('FireflyIII\User');
}
/**