Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
15 / 15 |
AdservingProvider | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
15 / 15 |
boot | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
register | |
100.00% |
1 / 1 |
1 | |
100.00% |
12 / 12 |
1 | <?php |
2 | |
3 | namespace Qmp\Laravel\Adserving\Providers; |
4 | |
5 | use Illuminate\Support\Facades\Log; |
6 | use Illuminate\Support\ServiceProvider; |
7 | use Qmp\Laravel\Adserving\Objects\HtmlGenerator; |
8 | use Qmp\Laravel\Adserving\Objects\ShopsReader; |
9 | use Qmp\Laravel\Adserving\Services\Drawer\Drawer; |
10 | use Qmp\Laravel\MicroService\DbConnection\DbConnection; |
11 | use Qmp\Laravel\MicroService\QueueConnection\QueueConnection; |
12 | |
13 | class AdservingProvider extends ServiceProvider |
14 | { |
15 | /** |
16 | * Boot the service provider. |
17 | * |
18 | * @return void |
19 | */ |
20 | public function boot() |
21 | { |
22 | $this->loadMigrationsFrom(__DIR__ . '/../database/migrations/'); |
23 | $this->loadViewsFrom(realpath(__DIR__ . '/../Views'), 'adserving'); |
24 | } |
25 | |
26 | public function register() |
27 | { |
28 | DbConnection::mergeFromFile(realpath(__DIR__.'/../../config/connection.php')); |
29 | QueueConnection::mergeFromFile(realpath(__DIR__.'/../../config/queue.php')); |
30 | |
31 | $this->app->singleton(ShopsReader::class, function ($app) { |
32 | return new ShopsReader($app->request->file('fileCsv')->getRealPath()); |
33 | }); |
34 | |
35 | $this->app->singleton(Drawer::class, function ($app) { |
36 | return new Drawer(); |
37 | }); |
38 | |
39 | $this->app->singleton(HtmlGenerator::class, function ($app) { |
40 | return new HtmlGenerator(); |
41 | }); |
42 | } |
43 | } |