Test Failed
Push — feature-laravel-5.4 ( 2b4b90...5bfdc4 )
by Kirill
03:52
created

AppServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of laravel.su package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
declare(strict_types = 1);
10
11
namespace App\Providers;
12
13
use Illuminate\Config\Repository;
14
use Illuminate\Foundation\Application;
15
use Illuminate\Support\ServiceProvider;
16
17
/**
18
 * Class AppServiceProvider.
19
 */
20
class AppServiceProvider extends ServiceProvider
21
{
22
    /**
23
     * @var Application
24
     */
25
    protected $app;
26
27
    /**
28
     * @retrun void
29
     */
30
    public function register(): void
31
    {
32
        $this->loadLocalProviders($this->app->make(Repository::class));
33
    }
34
35
    /**
36
     * @param Repository $repository
37
     * @return void
38
     */
39
    private function loadLocalProviders(Repository $repository): void
40
    {
41
        if ($this->app->isLocal()) {
42
            $providers = (array)$repository->get('app.local_providers', []);
43
44
            foreach ($providers as $provider) {
45
                $this->app->register($provider);
46
            }
47
        }
48
    }
49
}
50