chore: code cleanup.

This commit is contained in:
James Cole
2023-05-29 13:56:55 +02:00
parent 7f7644c92f
commit 1b52147a05
295 changed files with 12418 additions and 12324 deletions

View File

@@ -58,6 +58,44 @@ class JournalServiceProvider extends ServiceProvider
$this->registerGroupCollector();
}
/**
*
*/
private function registerGroupCollector(): void
{
$this->app->bind(
GroupCollectorInterface::class,
static function (Application $app) {
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollector::class);
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
$collector->setUser(auth()->user());
}
return $collector;
}
);
}
/**
* Register group repos.
*/
private function registerGroupRepository(): void
{
$this->app->bind(
TransactionGroupRepositoryInterface::class,
static function (Application $app) {
/** @var TransactionGroupRepositoryInterface $repository */
$repository = app(TransactionGroupRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
$repository->setUser(auth()->user());
}
return $repository;
}
);
}
/**
* Register repository.
*/
@@ -104,42 +142,4 @@ class JournalServiceProvider extends ServiceProvider
}
);
}
/**
* Register group repos.
*/
private function registerGroupRepository(): void
{
$this->app->bind(
TransactionGroupRepositoryInterface::class,
static function (Application $app) {
/** @var TransactionGroupRepositoryInterface $repository */
$repository = app(TransactionGroupRepository::class);
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
$repository->setUser(auth()->user());
}
return $repository;
}
);
}
/**
*
*/
private function registerGroupCollector(): void
{
$this->app->bind(
GroupCollectorInterface::class,
static function (Application $app) {
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollector::class);
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
$collector->setUser(auth()->user());
}
return $collector;
}
);
}
}