Test Failed
Push — feature-laravel-5.4 ( 1c0ad8...11ab58 )
by Kirill
04:08
created

AppServiceProvider::loadProductionProviders()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
c 0
b 0
f 0
nc 3
nop 1
dl 10
loc 10
rs 9.4285
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 App\Models\Tip\ContentObserver;
14
use Illuminate\Config\Repository;
15
use Illuminate\Foundation\Application;
16
use Illuminate\Support\ServiceProvider;
17
use Service\ContentRenderer\ContentRendererInterface;
18
use Service\ContentRenderer\RenderersRepository;
19
20
/**
21
 * Class AppServiceProvider.
22
 */
23
class AppServiceProvider extends ServiceProvider
24
{
25
    /**
26
     * @var Application
27
     */
28
    protected $app;
29
30
    /**
31
     * @retrun void
32
     * @throws \InvalidArgumentException?query=is%3Aresolved
33
     */
34
    public function register(): void
35
    {
36
        $this->loadLocalProviders($this->app->make(Repository::class));
37
        $this->loadProductionProviders($this->app->make(Repository::class));
38
    }
39
40
    /**
41
     * @param Repository $repository
42
     * @return void
43
     */
44 View Code Duplication
    private function loadProductionProviders(Repository $repository): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    {
46
        if (!$this->app->isLocal()) {
47
            $providers = (array) $repository->get('app.production_providers', []);
48
49
            foreach ($providers as $provider) {
50
                $this->app->register($provider);
51
            }
52
        }
53
    }
54
55
    /**
56
     * @param  Repository $repository
57
     * @return void
58
     */
59 View Code Duplication
    private function loadLocalProviders(Repository $repository): void
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
    {
61
        if ($this->app->isLocal()) {
62
            $providers = (array) $repository->get('app.local_providers', []);
63
64
            foreach ($providers as $provider) {
65
                $this->app->register($provider);
66
            }
67
        }
68
    }
69
}
70