Test Failed
Push — feature-laravel-5.4 ( 475d96...446986 )
by Kirill
07:30
created

DataProviderServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
1
<?php
2
/**
3
 * This file is part of laravel.su package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace App\Providers;
10
11
use App\Services\DataProviders\Manager;
12
use Illuminate\Contracts\Config\Repository;
13
use Illuminate\Foundation\Application;
14
use Illuminate\Support\ServiceProvider;
15
16
/**
17
 * Class DataProviderServiceProvider.
18
 */
19
class DataProviderServiceProvider extends ServiceProvider
20
{
21
    public function register(): void
22
    {
23
        $this->app->singleton(Manager::class, function (Application $app) {
24
            $config = $app->make(Repository::class);
25
            $providers = (array)$config->get('data-providers.providers', []);
26
27
            return new Manager($providers, $app);
28
        });
29
    }
30
}