mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
parent
b80db054e2
commit
5e1167b8ae
@ -241,12 +241,12 @@ having transaction_count = 0
|
||||
private function reportSum()
|
||||
{
|
||||
/** @var UserRepositoryInterface $userRepository */
|
||||
$userRepository = app('FireflyIII\Repositories\User\UserRepositoryInterface');
|
||||
$userRepository = app(UserRepositoryInterface::class);
|
||||
|
||||
/** @var User $user */
|
||||
foreach ($userRepository->all() as $user) {
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface', [$user]);
|
||||
$repository = app(AccountRepositoryInterface::class, [$user]);
|
||||
$sum = $repository->sumOfEverything();
|
||||
if (bccomp($sum, '0') !== 0) {
|
||||
$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');
|
||||
|
@ -44,7 +44,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
{
|
||||
$this->repository = app('FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface');
|
||||
/** @var AttachmentRepositoryInterface repository */
|
||||
$this->repository = app(AttachmentRepositoryInterface::class);
|
||||
// make storage:
|
||||
$this->uploadDisk = Storage::disk('upload');
|
||||
$this->exportDisk = Storage::disk('export');
|
||||
|
@ -11,6 +11,8 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Export;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Export\Collector\AttachmentCollector;
|
||||
use FireflyIII\Export\Collector\UploadCollector;
|
||||
use FireflyIII\Export\Entry\Entry;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@ -78,7 +80,8 @@ class Processor
|
||||
*/
|
||||
public function collectAttachments(): bool
|
||||
{
|
||||
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
|
||||
/** @var AttachmentCollector $attachmentCollector */
|
||||
$attachmentCollector = app(AttachmentCollector::class, [$this->job]);
|
||||
$attachmentCollector->run();
|
||||
$this->files = $this->files->merge($attachmentCollector->getFiles());
|
||||
|
||||
@ -110,7 +113,8 @@ class Processor
|
||||
*/
|
||||
public function collectOldUploads(): bool
|
||||
{
|
||||
$uploadCollector = app('FireflyIII\Export\Collector\UploadCollector', [$this->job]);
|
||||
/** @var UploadCollector $uploadCollector */
|
||||
$uploadCollector = app(UploadCollector::class, [$this->job]);
|
||||
$uploadCollector->run();
|
||||
|
||||
$this->files = $this->files->merge($uploadCollector->getFiles());
|
||||
@ -139,7 +143,7 @@ class Processor
|
||||
*/
|
||||
public function createConfigFile(): bool
|
||||
{
|
||||
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
|
||||
$this->configurationMaker = app(ConfigurationFile::class, [$this->job]);
|
||||
$this->files->push($this->configurationMaker->make());
|
||||
|
||||
return true;
|
||||
|
@ -40,7 +40,7 @@ class AttachUserRole
|
||||
{
|
||||
Log::debug('Trigger attachuserrole');
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\User\UserRepositoryInterface');
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
|
||||
// first user ever?
|
||||
if ($repository->count() == 1) {
|
||||
|
@ -19,7 +19,7 @@ class AccountId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$var = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$account = $repository->find($var);
|
||||
|
||||
|
@ -22,7 +22,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
@ -44,7 +44,6 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
|
||||
/**
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param $value
|
||||
*
|
||||
* @return Account
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$account = $repository->find(intval($this->mapped[$this->index][$this->value]));
|
||||
|
||||
|
@ -30,7 +30,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
|
@ -19,7 +19,7 @@ class BillId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Bill
|
||||
{
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$bill = $repository->find($value);
|
||||
|
||||
|
@ -19,7 +19,7 @@ class BillName extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Bill
|
||||
{
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
return $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -19,7 +19,7 @@ class BudgetId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$budget = $repository->find($value);
|
||||
|
||||
|
@ -20,7 +20,7 @@ class BudgetName extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
|
@ -19,7 +19,7 @@ class CategoryId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Category
|
||||
{
|
||||
/** @var SingleCategoryRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
|
||||
$repository = app(SingleCategoryRepositoryInterface::class);
|
||||
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$category = $repository->find($value);
|
||||
|
||||
|
@ -20,7 +20,7 @@ class CategoryName extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Category
|
||||
{
|
||||
/** @var SingleCategoryRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
|
||||
$repository = app(SingleCategoryRepositoryInterface::class);
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
|
@ -19,7 +19,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$currency = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -19,7 +19,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$currency = $repository->find($value);
|
||||
|
||||
|
@ -19,7 +19,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$currency = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -19,7 +19,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$currency = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -21,7 +21,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
public function convert()
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$account = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -20,7 +20,7 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$value = isset($this->mapped[$this->index][$this->value]) ? $this->mapped[$this->index][$this->value] : $this->value;
|
||||
$account = $repository->find($value);
|
||||
|
||||
|
@ -21,7 +21,7 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
|
||||
public function convert()
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$account = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
|
@ -19,7 +19,7 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Collection
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
$tags = new Collection;
|
||||
|
||||
$strings = explode(',', $this->value);
|
||||
|
@ -19,7 +19,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
public function convert(): Collection
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
|
||||
$tags = new Collection;
|
||||
|
||||
|
@ -6,6 +6,7 @@ use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Log;
|
||||
use Validator;
|
||||
|
||||
@ -244,8 +245,8 @@ class AssetAccount implements PostProcessorInterface
|
||||
}
|
||||
}
|
||||
// create new if not exists and return that one:
|
||||
/** @var \FireflyIII\Repositories\Account\AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$accountData = [
|
||||
'name' => $accountNumber,
|
||||
'accountType' => 'asset',
|
||||
|
@ -87,7 +87,7 @@ class ReportController extends Controller
|
||||
$budget = $budgetRepository->find(intval($attributes['budgetId']));
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
$accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
$account = $accountRepository->find(intval($attributes['accountId']));
|
||||
|
||||
switch (true) {
|
||||
@ -177,7 +177,7 @@ class ReportController extends Controller
|
||||
private function expenseEntry(array $attributes): string
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$account = $repository->find(intval($attributes['accountId']));
|
||||
$journals = $repository->getExpensesByDestination($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
|
||||
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
|
||||
@ -196,7 +196,7 @@ class ReportController extends Controller
|
||||
private function incomeEntry(array $attributes): string
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$account = $repository->find(intval($attributes['accountId']));
|
||||
$journals = $repository->getIncomeByDestination($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
|
||||
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
|
||||
|
@ -147,7 +147,7 @@ class ReportController extends Controller
|
||||
private function auditReport(Carbon $start, Carbon $end, Collection $accounts)
|
||||
{
|
||||
/** @var ARI $repos */
|
||||
$repos = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$repos = app(ARI::class);
|
||||
$auditData = [];
|
||||
$dayBefore = clone $start;
|
||||
$dayBefore->subDay();
|
||||
|
@ -289,7 +289,7 @@ class TransactionController extends Controller
|
||||
{
|
||||
$subTitle = trans('firefly.mass_edit_journals');
|
||||
/** @var ARI $accountRepository */
|
||||
$accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$accountRepository = app(ARI::class);
|
||||
$accountList = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
|
||||
|
||||
// put previous url in session
|
||||
|
@ -263,7 +263,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
{
|
||||
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
$accountRepository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
$amount = '0';
|
||||
$creditCards = $accountRepository->getCreditCards($end); // Find credit card accounts and possibly unpaid credit card bills.
|
||||
/** @var Account $creditCard */
|
||||
|
Loading…
Reference in New Issue
Block a user