-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProductionServiceProvider.php
94 lines (79 loc) · 2.99 KB
/
ProductionServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
namespace App\Providers\ServiceProviders;
use App\Lib\Context\AuthUserContext;
use App\Lib\Transaction\LaravelDbTransaction;
use App\Providers\OriginalUserProvider;
use Authorization\Application\Service\Authenticate\AuthenticateService;
use Authorization\Application\Service\User\UserApplicationService;
use Authorization\DebugInfrastructure\Persistence\DebugUserFactory;
use Authorization\DebugInfrastructure\Persistence\FileUserRepository;
use Authorization\Domain\Users\UserFactoryInterface;
use Authorization\Domain\Users\UserRepositoryInterface;
use Basic\Transaction\Transaction;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Hashing\Hasher;
use Illuminate\Hashing\BcryptHasher;
use nrslib\RepositorySupports\FileRepositoryConfig;
use Scrum\Application\Service\BackLog\BackLogApplicationService;
use Scrum\Application\Service\BackLog\Query\BackLogQueryServiceInterface;
use Scrum\Domain\Models\User\UserContextInterface;
use Scrum\Domain\Models\UserStories\UserStoryRepositoryInterface;
use Scrum\EloquentInfrastructure\Persistence\UserStories\EloquentUserStoryRepository;
use Scrum\EloquentInfrastructure\QueryServices\EloquentBackLogQueryService;
class ProductionServiceProvider implements Provider
{
/** @var Application */
private $app;
/**
* LocalServiceProvider constructor.
* @param Application $app
*/
public function __construct(Application $app)
{
$this->app = $app;
}
public function register()
{
$this->registerLibrary();
$this->registerProviders();
$this->registerUtilities();
$this->registerApplications();
$this->registerInfrastructures();
}
function boot()
{
$debugPersistenceDirectoryFullPath = storage_path("debug\\persistence");
FileRepositoryConfig::$basicDirectoryFullPath = $debugPersistenceDirectoryFullPath;
}
private function registerLibrary()
{
$this->app->bind(Transaction::class, LaravelDbTransaction::class);
$this->app->bind(UserContextInterface::class, AuthUserContext::class);
}
private function registerProviders()
{
$this->app->bind(OriginalUserProvider::class);
}
private function registerUtilities()
{
$this->app->bind(Hasher::class, BcryptHasher::class);
}
private function registerApplications()
{
$this->app->bind(BackLogApplicationService::class);
// Auth
$this->app->bind(AuthenticateService::class);
$this->app->bind(UserApplicationService::class);
}
private function registerInfrastructures()
{
$this->app->bind(
BackLogQueryServiceInterface::class,
EloquentBackLogQueryService::class
);
$this->app->bind(UserStoryRepositoryInterface::class, EloquentUserStoryRepository::class);
// Auth
$this->app->bind(UserFactoryInterface::class, DebugUserFactory::class);
$this->app->bind(UserRepositoryInterface::class, FileUserRepository::class);
}
}