mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup.
This commit is contained in:
parent
5a7b1ba292
commit
b12872e5de
@ -171,7 +171,9 @@ class TransactionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionRequest $request
|
||||
* @param TransactionRequest $request
|
||||
*
|
||||
* @param JournalRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
@ -244,12 +244,12 @@ class ReconcileController extends Controller
|
||||
|
||||
/**
|
||||
* @param ReconciliationStoreRequest $request
|
||||
* @param JournalRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function submit(ReconciliationStoreRequest $request, JournalRepositoryInterface $repository, Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
@ -128,9 +128,8 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
@ -152,15 +151,16 @@ class AccountController extends Controller
|
||||
/**
|
||||
* Edit an account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return View
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @return View
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||
{
|
||||
@ -277,16 +277,16 @@ class AccountController extends Controller
|
||||
/**
|
||||
* Show an account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param string $moment
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
@ -365,9 +365,8 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountFormRequest $request
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
* @param AccountFormRequest $request
|
||||
* @param Account $account
|
||||
*
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
@ -410,8 +409,9 @@ class AccountController extends Controller
|
||||
* and for each period, the amount of money spent and earned. This is a complex operation which is cached for
|
||||
* performance reasons.
|
||||
*
|
||||
* @param Account $account the account involved
|
||||
* @param Account $account the account involved
|
||||
*
|
||||
* @param Carbon|null $date
|
||||
* @return Collection
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
|
@ -167,6 +167,7 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param string|null $moment
|
||||
*
|
||||
* @return View
|
||||
@ -545,8 +546,9 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param Request $request
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
|
@ -424,6 +424,8 @@ class CategoryController extends Controller
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
private function getPeriodOverview(Category $category, Carbon $date): Collection
|
||||
|
@ -299,6 +299,8 @@ class AccountController extends Controller
|
||||
* @param Account $account
|
||||
* @param Carbon $start
|
||||
*
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function period(Account $account, Carbon $start, Carbon $end)
|
||||
|
@ -198,7 +198,9 @@ class BoxController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @param CurrencyRepositoryInterface $currencyRepos
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
@ -59,7 +59,9 @@ class PiggyBankController extends Controller
|
||||
/**
|
||||
* Add money to piggy bank.
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
@ -78,8 +80,9 @@ class PiggyBankController extends Controller
|
||||
/**
|
||||
* Add money to piggy bank (for mobile devices).
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
* @return View
|
||||
*/
|
||||
public function addMobile(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
|
||||
@ -180,6 +183,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param PiggyBankRepositoryInterface $piggyRepository
|
||||
*
|
||||
* @return View
|
||||
|
@ -170,6 +170,8 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function enable2FA(UserRepositoryInterface $repository)
|
||||
|
@ -66,6 +66,7 @@ class BulkController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Collection $journals
|
||||
*
|
||||
* @return View
|
||||
|
@ -238,7 +238,9 @@ class SingleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @param JournalRepositoryInterface $repository
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
@ -37,7 +37,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Transformers\TransactionTransformer;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
@ -65,8 +64,6 @@ class SplitController extends Controller
|
||||
private $currencies;
|
||||
/** @var JournalRepositoryInterface */
|
||||
private $repository;
|
||||
/** @var JournalTaskerInterface */
|
||||
private $tasker;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -80,7 +77,6 @@ class SplitController extends Controller
|
||||
function ($request, $next) {
|
||||
$this->accounts = app(AccountRepositoryInterface::class);
|
||||
$this->budgets = app(BudgetRepositoryInterface::class);
|
||||
$this->tasker = app(JournalTaskerInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->currencies = app(CurrencyRepositoryInterface::class);
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
|
@ -30,7 +30,6 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use FireflyIII\Transformers\TransactionTransformer;
|
||||
@ -71,7 +70,6 @@ class TransactionController extends Controller
|
||||
*
|
||||
* @return View
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function index(Request $request, JournalRepositoryInterface $repository, string $what, string $moment = '')
|
||||
{
|
||||
@ -176,13 +174,13 @@ class TransactionController extends Controller
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param JournalTaskerInterface $tasker
|
||||
* @param JournalRepositoryInterface $repository
|
||||
* @param LinkTypeRepositoryInterface $linkTypeRepository
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show(TransactionJournal $journal, JournalTaskerInterface $tasker, LinkTypeRepositoryInterface $linkTypeRepository)
|
||||
public function show(TransactionJournal $journal, JournalRepositoryInterface $repository, LinkTypeRepositoryInterface $linkTypeRepository)
|
||||
{
|
||||
if ($this->isOpeningBalance($journal)) {
|
||||
return $this->redirectToAccount($journal);
|
||||
@ -208,7 +206,7 @@ class TransactionController extends Controller
|
||||
$transactions[] = $transformer->transform($transaction);
|
||||
}
|
||||
|
||||
$events = $tasker->getPiggyBankEvents($journal);
|
||||
$events = $repository->getPiggyBankEvents($journal);
|
||||
$what = strtolower($transactionType);
|
||||
$subTitle = trans('firefly.' . $what) . ' "' . $journal->description . '"';
|
||||
|
||||
|
@ -74,8 +74,7 @@ class Authenticate
|
||||
*
|
||||
* @param array $guards
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
*/
|
||||
protected function authenticate(array $guards)
|
||||
|
@ -63,7 +63,6 @@ class Binder
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
*/
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ class SplitJournalFormRequest extends Request
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Validator $validator
|
||||
*/
|
||||
protected function sameAccounts(Validator $validator): void
|
||||
{
|
||||
|
@ -78,9 +78,8 @@ class CsvProcessor implements FileProcessorInterface
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \League\Csv\Exception
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
* @throws FireflyException
|
||||
* @throws \League\Csv\Exception
|
||||
*/
|
||||
public function run(): bool
|
||||
{
|
||||
|
@ -117,8 +117,10 @@ class SpectreRoutine implements RoutineInterface
|
||||
* have-account-mapping: start downloading transactions?
|
||||
*
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
* @throws SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
public function run(): bool
|
||||
{
|
||||
@ -166,6 +168,7 @@ class SpectreRoutine implements RoutineInterface
|
||||
* @return Customer
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
protected function createCustomer(): Customer
|
||||
{
|
||||
@ -201,7 +204,8 @@ class SpectreRoutine implements RoutineInterface
|
||||
/**
|
||||
* @return Customer
|
||||
* @throws FireflyException
|
||||
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
|
||||
* @throws SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
protected function getCustomer(): Customer
|
||||
{
|
||||
@ -230,6 +234,7 @@ class SpectreRoutine implements RoutineInterface
|
||||
* @return Token
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
protected function getToken(Customer $customer, string $returnUri): Token
|
||||
{
|
||||
@ -246,6 +251,7 @@ class SpectreRoutine implements RoutineInterface
|
||||
/**
|
||||
* @throws FireflyException
|
||||
* @throws SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
protected function runStageInitial(): void
|
||||
{
|
||||
@ -280,6 +286,7 @@ class SpectreRoutine implements RoutineInterface
|
||||
/**
|
||||
* @throws FireflyException
|
||||
* @throws SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
protected function runStageLoggedIn(): void
|
||||
{
|
||||
@ -521,6 +528,7 @@ class SpectreRoutine implements RoutineInterface
|
||||
/**
|
||||
* @throws FireflyException
|
||||
* @throws SpectreException
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
private function runStageHaveMapping()
|
||||
{
|
||||
|
@ -26,8 +26,6 @@ use FireflyIII\Helpers\Collector\JournalCollector;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepository;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTasker;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@ -50,7 +48,6 @@ class JournalServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->registerRepository();
|
||||
$this->registerTasker();
|
||||
$this->registerCollector();
|
||||
}
|
||||
|
||||
@ -91,24 +88,4 @@ class JournalServiceProvider extends ServiceProvider
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the tasker.
|
||||
*/
|
||||
private function registerTasker()
|
||||
{
|
||||
$this->app->bind(
|
||||
JournalTaskerInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var JournalTaskerInterface $tasker */
|
||||
$tasker = app(JournalTasker::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$tasker->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return $tasker;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -228,8 +228,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @throws FireflyException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function store(array $data): Account
|
||||
{
|
||||
@ -245,8 +243,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param Account $account
|
||||
* @param array $data
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws Exception
|
||||
* @return Account
|
||||
*/
|
||||
public function update(Account $account, array $data): Account
|
||||
@ -263,8 +259,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return TransactionJournal
|
||||
* @throws FireflyException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateReconciliation(TransactionJournal $journal, array $data): TransactionJournal
|
||||
{
|
||||
|
@ -216,8 +216,6 @@ trait FindAccountsTrait
|
||||
/**
|
||||
* @return Account
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getCashAccount(): Account
|
||||
{
|
||||
|
@ -306,7 +306,6 @@ class BillRepository implements BillRepositoryInterface
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ use FireflyIII\Factory\TransactionJournalFactory;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\PiggyBankEvent;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
@ -470,6 +471,24 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
return $note->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPiggyBankEvents(TransactionJournal $journal): Collection
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$events = $journal->piggyBankEvents()->get();
|
||||
$events->each(
|
||||
function (PiggyBankEvent $event) {
|
||||
$event->piggyBank = $event->piggyBank()->withTrashed()->first();
|
||||
}
|
||||
);
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all tags as strings in an array.
|
||||
*
|
||||
@ -623,7 +642,6 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function update(TransactionJournal $journal, array $data): TransactionJournal
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ use Illuminate\Support\MessageBag;
|
||||
*/
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionType $type
|
||||
@ -201,6 +202,13 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function getNoteText(TransactionJournal $journal): string;
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPiggyBankEvents(TransactionJournal $journal): Collection;
|
||||
|
||||
/**
|
||||
* Return all tags as strings in an array.
|
||||
*
|
||||
|
@ -1,71 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* JournalTasker.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
use DB;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\PiggyBankEvent;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Steam;
|
||||
|
||||
/**
|
||||
* Class JournalTasker.
|
||||
*/
|
||||
class JournalTasker implements JournalTaskerInterface
|
||||
{
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPiggyBankEvents(TransactionJournal $journal): Collection
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$events = $journal->piggyBankEvents()->get();
|
||||
$events->each(
|
||||
function (PiggyBankEvent $event) {
|
||||
$event->piggyBank = $event->piggyBank()->withTrashed()->first();
|
||||
}
|
||||
);
|
||||
|
||||
return $events;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* JournalTaskerInterface.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Interface JournalTaskerInterface.
|
||||
*/
|
||||
interface JournalTaskerInterface
|
||||
{
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @deprecated
|
||||
* @return Collection
|
||||
*/
|
||||
public function getPiggyBankEvents(TransactionJournal $journal): Collection;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
}
|
@ -38,7 +38,7 @@ class UniqueIban implements Rule
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
* @param Account|null $account
|
||||
*/
|
||||
public function __construct(?Account $account)
|
||||
{
|
||||
|
@ -127,6 +127,7 @@ trait AccountServiceTrait
|
||||
* @param array $data
|
||||
*
|
||||
* @return TransactionJournal|null
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function storeIBJournal(Account $account, array $data): ?TransactionJournal
|
||||
{
|
||||
|
@ -258,7 +258,6 @@ abstract class SpectreRequest
|
||||
* @param Requests_Response $response
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws SpectreException
|
||||
*/
|
||||
private function detectError(Requests_Response $response): void
|
||||
{
|
||||
|
@ -46,6 +46,7 @@ class ExpandedForm
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function amount(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@ -53,12 +54,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function amountSmall(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@ -118,13 +120,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function balance(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@ -653,6 +655,7 @@ class ExpandedForm
|
||||
* @return string
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function currencyField(string $name, string $view, $value = null, array $options = []): string
|
||||
{
|
||||
|
@ -52,7 +52,6 @@ class Map implements ConfigurationInterface
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \League\Csv\Exception
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function getData(): array
|
||||
{
|
||||
|
@ -52,7 +52,6 @@ class Roles implements ConfigurationInterface
|
||||
* @return array
|
||||
*
|
||||
* @throws \League\Csv\Exception
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function getData(): array
|
||||
{
|
||||
|
@ -261,7 +261,6 @@ class Search implements SearchInterface
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function matchModifiers(Transaction $transaction): bool
|
||||
{
|
||||
|
@ -67,6 +67,7 @@ final class Processor
|
||||
* @param bool $includeActions
|
||||
*
|
||||
* @return Processor
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public static function make(Rule $rule, $includeActions = true)
|
||||
{
|
||||
@ -229,6 +230,7 @@ final class Processor
|
||||
* Run the actions
|
||||
*
|
||||
* @return bool
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
private function actions()
|
||||
{
|
||||
|
@ -26,7 +26,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
@ -42,29 +41,18 @@ class TransactionMatcher
|
||||
private $range = 200;
|
||||
/** @var Rule The rule to apply */
|
||||
private $rule;
|
||||
/** @var JournalTaskerInterface Tasker for some related tasks */
|
||||
private $tasker;
|
||||
/** @var array Types that can be matched using this matcher */
|
||||
private $transactionTypes = [TransactionType::DEPOSIT, TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
|
||||
/** @var array List of triggers to match */
|
||||
private $triggers = [];
|
||||
|
||||
/**
|
||||
* TransactionMatcher constructor. Typehint the repository.
|
||||
*
|
||||
* @param JournalTaskerInterface $tasker
|
||||
*/
|
||||
public function __construct(JournalTaskerInterface $tasker)
|
||||
{
|
||||
$this->tasker = $tasker;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will search the user's transaction journal (with an upper limit of $range) for
|
||||
* transaction journals matching the given rule. This is accomplished by trying to fire these
|
||||
* triggers onto each transaction journal until enough matches are found ($limit).
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function findTransactionsByRule()
|
||||
{
|
||||
@ -89,6 +77,7 @@ class TransactionMatcher
|
||||
* triggers onto each transaction journal until enough matches are found ($limit).
|
||||
*
|
||||
* @return Collection
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
*/
|
||||
public function findTransactionsByTriggers(): Collection
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
* This class will be magical!
|
||||
*
|
||||
* Class AbstractTrigger
|
||||
* @method triggered
|
||||
* @method bool triggered($object)
|
||||
*/
|
||||
class AbstractTrigger
|
||||
{
|
||||
|
@ -33,9 +33,6 @@ declare(strict_types=1);
|
||||
|
|
||||
*/
|
||||
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Monolog\Logger;
|
||||
|
||||
bcscale(12);
|
||||
|
||||
|
@ -219,7 +219,7 @@
|
||||
|
||||
{# description #}
|
||||
<div class="col-lg-3 col-md-5 col-sm-12 col-xs-12">
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][description]"
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][transaction_description]"
|
||||
value="{{ transaction.transaction_description }}"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
@ -227,7 +227,7 @@
|
||||
{# destination for withdrawals: #}
|
||||
{% if preFilled.what == 'withdrawal' %}
|
||||
<div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][destination_account_name]"
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][destination_name]"
|
||||
value="{{ transaction.destination_name }}" class="form-control"/>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -235,7 +235,7 @@
|
||||
{# source for deposits #}
|
||||
{% if preFilled.what == 'deposit' %}
|
||||
<div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][source_account_name]"
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][source_name]"
|
||||
value="{{ transaction.source_name }}" class="form-control"/>
|
||||
</div>
|
||||
{% endif %}
|
||||
@ -285,7 +285,7 @@
|
||||
|
||||
{# category #}
|
||||
<div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][category]"
|
||||
<input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][category_name]"
|
||||
value="{{ transaction.category_name}}"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
|
@ -309,6 +309,8 @@ class BudgetControllerTest extends TestCase
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\BudgetController::infoIncome
|
||||
* @dataProvider dateRangeProvider
|
||||
*
|
||||
* @param string $range
|
||||
*/
|
||||
public function testInfoIncomeExpanded(string $range)
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Google2FA;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Preferences;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user