Code cleanup.

This commit is contained in:
James Cole
2016-04-27 10:38:51 +02:00
parent 6aa50e3c00
commit 3d4489efe6
17 changed files with 81 additions and 108 deletions

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class AccountServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Account\AccountRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Account\AccountRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Account\AccountRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class AttachmentServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class BillServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Bill\BillRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Bill\BillRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Bill\BillRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class BudgetServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Budget\BudgetRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Budget\BudgetRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Budget\BudgetRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class CategoryServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Category\CategoryRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Category\CategoryRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Category\CategoryRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}
@@ -49,10 +48,10 @@ class CategoryServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Category\SingleCategoryRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Category\SingleCategoryRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -25,10 +24,10 @@ class ExportJobServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -35,10 +34,10 @@ class PiggyBankServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -35,10 +34,10 @@ class RuleGroupServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class RuleServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Rule\RuleRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Rule\RuleRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Rule\RuleRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -34,10 +33,10 @@ class TagServiceProvider extends ServiceProvider
$this->app->bind(
'FireflyIII\Repositories\Tag\TagRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\Tag\TagRepository', [Auth::user()]);
if (!isset($arguments[0]) && $app->auth->check()) {
return app('FireflyIII\Repositories\Tag\TagRepository', [$app->auth->user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
if (!isset($arguments[0]) && !$app->auth->check()) {
throw new FireflyException('There is no user present.');
}
}