Various code cleanup.

This commit is contained in:
James Cole
2017-02-25 05:57:01 +01:00
parent 444439fdab
commit 8c6972d12d
35 changed files with 133 additions and 171 deletions

View File

@@ -122,12 +122,15 @@ class RegisterController extends Controller
*/
protected function create(array $data)
{
return User::create(
/** @var User $user */
$user = User::create(
[
'email' => $data['email'],
'password' => bcrypt($data['password']),
]
);
return $user;
}
/**

View File

@@ -79,9 +79,11 @@ class TwoFactorController extends Controller
/**
* @param TokenFormRequest $request
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.
* @param CookieJar $cookieJar
*
* @return mixed
* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.
*
*/
public function postIndex(TokenFormRequest $request, CookieJar $cookieJar)
{

View File

@@ -105,7 +105,8 @@ class BudgetController extends Controller
}
/**
* @param Budget $budget
* @param Request $request
* @param Budget $budget
*
* @return View
*/
@@ -214,6 +215,8 @@ class BudgetController extends Controller
}
/**
* @param BudgetIncomeRequest $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postUpdateIncome(BudgetIncomeRequest $request)

View File

@@ -203,6 +203,7 @@ class BudgetReportController extends Controller
* Returns the budget limits belonging to the given budget and valid on the given day.
*
* @param Collection $budgetLimits
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
@@ -268,21 +269,4 @@ class BudgetReportController extends Controller
return $grouped;
}
/**
* @param Collection $set
*
* @return array
*/
private function groupByOpposingAccount(Collection $set): array
{
$grouped = [];
/** @var Transaction $transaction */
foreach ($set as $transaction) {
$accountId = $transaction->opposing_account_id;
$grouped[$accountId] = $grouped[$accountId] ?? '0';
$grouped[$accountId] = bcadd($transaction->transaction_amount, $grouped[$accountId]);
}
return $grouped;
}
}

View File

@@ -20,7 +20,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use Navigation;
@@ -50,13 +50,13 @@ class CategoryController extends Controller
/**
* Show an overview for a category for all time, per month/week/year.
*
* @param CRI $repository
* @param AccountRepositoryInterface $accountRepository
* @param Category $category
* @param CategoryRepositoryInterface $repository
* @param AccountRepositoryInterface $accountRepository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function all(CRI $repository, AccountRepositoryInterface $accountRepository, Category $category)
public function all(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository, Category $category)
{
$cache = new CacheProperties;
$cache->addProperty('chart.category.all');
@@ -106,12 +106,12 @@ class CategoryController extends Controller
}
/**
* @param CRI $repository
* @param Category $category
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function currentPeriod(CRI $repository, Category $category)
public function currentPeriod(CategoryRepositoryInterface $repository, Category $category)
{
$start = clone session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
@@ -121,12 +121,12 @@ class CategoryController extends Controller
}
/**
* @param CRI $repository
* @param AccountRepositoryInterface $accountRepository
* @param CategoryRepositoryInterface $repository
* @param AccountRepositoryInterface $accountRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function frontpage(CRI $repository, AccountRepositoryInterface $accountRepository)
public function frontpage(CategoryRepositoryInterface $repository, AccountRepositoryInterface $accountRepository)
{
$start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
@@ -161,15 +161,15 @@ class CategoryController extends Controller
}
/**
* @param CRI $repository
* @param Category $category
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
* @param CategoryRepositoryInterface $repository
* @param Category $category
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function reportPeriod(CRI $repository, Category $category, Collection $accounts, Carbon $start, Carbon $end)
public function reportPeriod(CategoryRepositoryInterface $repository, Category $category, Collection $accounts, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache->addProperty($start);
@@ -210,14 +210,14 @@ class CategoryController extends Controller
}
/**
* @param CRI $repository
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
* @param CategoryRepositoryInterface $repository
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return \Illuminate\Http\JsonResponse|mixed
*/
public function reportPeriodNoCategory(CRI $repository, Collection $accounts, Carbon $start, Carbon $end)
public function reportPeriodNoCategory(CategoryRepositoryInterface $repository, Collection $accounts, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache->addProperty($start);
@@ -257,14 +257,14 @@ class CategoryController extends Controller
}
/**
* @param CRI $repository
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @param $date
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function specificPeriod(CRI $repository, Category $category, $date)
public function specificPeriod(CategoryRepositoryInterface $repository, Category $category, $date)
{
$carbon = new Carbon($date);
$range = Preferences::get('viewRange', '1M')->data;
@@ -277,14 +277,14 @@ class CategoryController extends Controller
/**
* @param CRI $repository
* @param Category $category
* @param Carbon $start
* @param Carbon $end
* @param CategoryRepositoryInterface $repository
* @param Category $category
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
private function makePeriodChart(CRI $repository, Category $category, Carbon $start, Carbon $end)
private function makePeriodChart(CategoryRepositoryInterface $repository, Category $category, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache->addProperty($start);

View File

@@ -50,6 +50,8 @@ class CurrencyController extends Controller
}
/**
* @param Request $request
*
* @return View
*/
public function create(Request $request)
@@ -90,6 +92,7 @@ class CurrencyController extends Controller
/**
* @param Request $request
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
@@ -115,6 +118,7 @@ class CurrencyController extends Controller
}
/**
* @param Request $request
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*

View File

@@ -55,9 +55,10 @@ class ExportController extends Controller
}
/**
* @param EJRI $repository
* @param ExportJob $job
*
* @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
* @throws FireflyException
*/
public function download(ExportJobRepositoryInterface $repository, ExportJob $job)

View File

@@ -27,7 +27,9 @@ class JavascriptController extends Controller
{
/**
* @param Request $request
*
* @return $this
*/
public function variables(Request $request)
{

View File

@@ -329,7 +329,9 @@ class JsonController extends Controller
}
/**
* @param JournalRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
*/
public function transactionTypes(JournalRepositoryInterface $repository)
{

View File

@@ -56,7 +56,7 @@ class SearchController extends Controller
$limit = 20;
// ui stuff:
$subTitle = '';
$subTitle = '';
// query stuff
$query = null;

View File

@@ -219,7 +219,7 @@ class TagController extends Controller
}
}
return view('tags.index', compact('title', 'mainTitleIcon', 'types', 'collection','count'));
return view('tags.index', compact('title', 'mainTitleIcon', 'types', 'collection', 'count'));
}
/**